Redirecting non-WP URLs
-
My old site uses static HTML files and folders. I would like to migrate its content to WordPress without breaking external sites that are linking to the old URLs.
An example of an existing file is this:
https://www.gamebits.net/gcn/crzytaxi.shtml
Under WordPress, that content will be slug “crzytaxi” in category “gcn”, producing a new URL:
https://www.gamebits.net/gcn/crzytaxi
But none of the permalink redirect plug-ins I’ve tried work to convert /%category%/%postname%.shtml to /%category%/%postname% , and I can’t come up with an .htaccess RewriteRule that will accomplish what I want while jiving with WordPress’s rules. Can anyone suggest a way to redirect my non-WP URLs (without creating hundreds of individual files redirecting each possible URL instance)?
I’ve read this post and the link on it and ended up with this .htaccess file that does not redirect URLs ending in .shtml:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{query_string} ^\.shtml$
RewriteRule ^(.*)\.shtml(/.*)? /$1$2 [R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
- The topic ‘Redirecting non-WP URLs’ is closed to new replies.