1

I have WordPress installed in a folder and have gone through this process in the WordPress codex to remove the sub-folder from the url. Works beautifully, oldDomain.com/folder/page/ is now oldDomain.com/page/.

My client wants to change the domain name for the site. Everything is redirecting except this case if people have the old url bookmarked - oldDomain.com/folder/page/ to newDomain.com/page/.

I tried this and nothing seems to happen:

RewriteCond %{HTTP_HOST} ^oldDomain\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.oldDomain\.com$ [NC]
RewriteRule ^folder/(.*)$ http://www.newDomain.com/$1 [R=301,L]

Similarly nothing happens when trying this:

RewriteRule ^folder/(.*)$ /$1 [R=301,L]

This works for the url but seems to break something with the stylesheets etc as all formatting disappears

RedirectMatch 301 ^/folder/(.*)$ /$1
4

1 回答 1

0
Redirect 301 ^folder/(.*)$ http://www.newDomain.com/$1

尝试这个。希望能帮助到你。

于 2013-03-28T06:36:01.520 回答