I have setup a new multisite WordPress install. Everything works fine, except Google is still crawling old URLs (which had a .php extension).
These URLs are now showing a 500 error, which seems to be due to an htaccess issue - i.e. these URLs are not hitting WordPress. (I am currently using the standard WordPress multisite htaccess code.)
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
I need to add a rewrite to the site's .htaccess that will remove the .php extension for the files that have them, and that are not found on the server (i.e. exclude WordPress core files like wp-login.php, etc.)
I used this code to remove the .php extension
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ / [L,QSA]
</IfModule>
This resolved the 500 error and allowed me to setup redirects for the old site using the wp-redirect plugin as I had originally intended, but it causes some issues with styles and images loading on some of the sub-folder multisites, so I think it needs improving!