我用RedirectMatch试过了,但是我的代码不工作。我的语法可能不正确。
下面是我的代码:
RedirectMatch 301 ^oldsite.com/guides/$ http://newsite.com/destinations/city-guides/
RedirectMatch 301 ^oldsite.com/show/$ http://newsite.com/tv-show/concept/
RedirectMatch 301 ^oldsite.com/destinations/$ http://newsite.com/tv-show/concept/
RedirectMatch 301 ^oldsite.com/concept.html http://newsite.com/tv-show/concept/
RedirectMatch 301 ^oldsite.com/format.html http://newsite.com/tv-show/format/
RedirectMatch 301 ^oldsite.com/about.html http://newsite.com/about/
RedirectMatch 301 ^oldsite.com/contact.html http://newsite.com/contact/前三行我希望那些旧目录中的任何文件都转到新目录的根目录。最后四个是特定的页面到页面重定向。
我做错了什么?
发布于 2014-02-22 06:07:52
您与RedirectMatch中的域名不匹配。仅匹配请求URI。
在旧网站的.htaccess上试试这个:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?oldsite\.com$ [NC]
RewriteRule ^ - [L]
RewriteRule ^guides/$ http://newsite.com/destinations/city-guides/ [L,R=301]
RewriteRule ^show/$ http://newsite.com/tv-show/concept/ [L,R=301]
RewriteRule ^destinations/$ http://newsite.com/tv-show/concept/ [L,R=301]
RewriteRule ^concept.html http://newsite.com/tv-show/concept/ [L,R=301]
RewriteRule ^format.html http://newsite.com/tv-show/format/ [L,R=301]
RewriteRule ^about.html http://newsite.com/about/ [L,R=301]
RewriteRule ^contact.html http://newsite.com/contact/ [L,R=301]https://stackoverflow.com/questions/21946113
复制相似问题