我正在将一个域重定向到另一个域,但我想保留重定向中的路径.例如,我想访问 www.example/services/education/page.html,但我的重定向会将它们带到 www.new-example/services/education/page.html.我在我的 .htaccess 文件中写了什么来保留路径/services/education/page.html"?
I am redirecting one domain to another, but I want to preserve the path in the redirect. So for example, I want to visit www.example/services/education/page.html, but my redirect will bring them to www.new-example/services/education/page.html. What do I write in my .htaccess file to preserve the path "/services/education/page.html"?
现在我有:
redirect 301 www.example/ www.new-example/但我不确定这是否有效(由于我正在等待域详细信息等,因此无法进行测试).我只是想确定我何时将网站上线.是这样还是我离基地很远?
But I'm not sure if that works or not (Can't test yet as I am waiting for domain details etc). I just want to be sure when I put the site live. Is that right or am I way off base?
谢谢!
推荐答案应该这样做:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !new-example$ [NC] RewriteRule ^(.*)$ new-example/$1 [L,R=301]更多推荐
如何在保留路径的同时 301 重定向整个域
发布评论