我们需要将htaccess重定向从一个页面设置到一个目录,这样就可以了:
Redirect 301 /page-name.html http://www.domain-01.co.uk/directory
但我们通过Magento建立了多个域名,因此需要这样做:
http://www.domain-01.co.uk/page-name.html重定向到http://www.domain-01.co.uk/directory http://www.domain-02.co.uk/page-name.html重定向到http://www.domain-02.co.uk/directory
这些不起作用:
Redirect 301 http://www.domain-01.co.uk/page-name.html http://www.domain-01.co.uk/directory
Redirect 301 http://www.domain-02.co.uk/page-name.html http://www.domain-02.co.uk/directory
或:
RewriteCond %{HTTP_HOST} ^www.domain-01.co.uk/page-name.html
Rewriterule ^(.*)$ http://www.domain-01.co.uk/directory [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain-02.co.uk/page-name.html
Rewriterule ^(.*)$ http://www.domain-02.co.uk/directory [R=301,L]
我看过文档(http://httpd.apache.org/docs/2.0/misc/rewriteguide.html#ToC1),但我看不到任何与此有关的内容。
在我看来问题是如何在重定向的第一部分中包含域名?或者我问错了问题?
答案 0 :(得分:0)
如果你想要每个域,你只需这样做
RewriteRule ^page-name\.html$ /directory [R=301,L]