Redirect site.example/guide/* to newsite.example/guide/* with .htaccess
I have a WordPress installed in a folder, not the root domain. I have my .htaccess
file all set up 开发者_开发问答in the root folder, but not for the WordPress folder.
I want to know how to redirect:
- www to non-www
site.example/guide/
tonewsite.example/guide/
- and
site.example/guide/some-article/
tonewsite.example/guide/some-article/
I was playing around with things, but site.example/guide/some-article/
was redirecting me to newsite.example/some-article/
, not newsite.example/guide/some-article/
. I would post the code here, but I got rid of it and saved the changes.
The www to non-www seems to be working with this snippet:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Add below rules with your short domain redirection rule:
RewriteCond %{REQUEST_URI} (.*)$
RewriteRule (.*)$ http://site.example%1 [R=301,L]
精彩评论