Forum Moderators: phranque
[edited by: crobb305 at 6:19 pm (utc) on Apr 16, 2015]
Redirect (or RedirectMatch). mod_alias (Redirect by that name) and mod_rewrite (RewriteRule, the core of any WP site) do not play nice together. So make sure you get rid of every last occurrence of Redirect-by-that-name in all htaccess files everywhere.
RewriteRule ^/blog/(.*)$ /newdirectory/$1 [R=301,L] [edited by: not2easy at 6:23 pm (utc) on Apr 16, 2015]
You could add in a rule to change the directory from /blog/ to /newdirectory/ and capture the string after the directory:
RewriteRule ^/blog/(.*)$ /newdirectory/$1 [R=301,L]
this should be in the htaccess file before the WP standard lines.
RedirectMatch 301 /blog/wp-content(.*) /newdirectory/wp-content$1
RedirectMatch 301 /blog/wp-content(.*) /newdirectory/wp-content$1
you need to change it to say RewriteRule ^blog/wp-content/(.*) http://www.example.com//newdirectory/wp-content/$1 [R=301,L]
Don't overlook the flags! Of course the rule could be worded as RewriteRule ^blog/(wp-content/.*) http://www.example.com//newdirectory/$1 [R=301,L]
but why bother capturing something that's always the same. Get rid of this. By the usual yawn-provoking coincidence it is no more than 24 hours since someone in an unrelated thread said he had been doing this successfully for years in a WP installation. But just because the Apache fairies were in a preternaturally good mood on his site is no reason to assume they will do the same on yours.