Wordpress rebuild - 301 redirect old pages (*.php) to pretty permalinks
Here is what I need to do:
old pages are mydomain.com/something.php
new pages are rebuilt in Wordpress identified using pretty permalinks so they are mydomain.com/something/
I need to figure out what the rewrite rule sho开发者_C百科uld look like. I have crawled the web and can't find anything exactly like it.
Something like:
RewriteEngine On
RewriteRule ^(.*)\.php$ $1/ [R=permanent]
The (.*) is a "group" of characters before the .php, and $1 refers to that group of characters. So just add a slash to the group and send the browser to the new URL with an HTTP code 301 (permanent redirect)
Try this:
RewriteEngine On
RewriteBase /
#Ignore index.php
RewriteCond %{REQUEST_URI} !index\.php
RewriteCond %{REQUEST_URI} !(wp-login|wp-admin|wp-includes)
RewriteCond %{REQUEST_URI} ^(.*)\.php$
RewriteRule ^(.*)\.php$ $1/ [R=301,L]
#"Standard" Wordpress Rewrite Stuff
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/catalog
RewriteRule . /index.php [L]
精彩评论