【发布时间】:2017-01-08 23:44:04
【问题描述】:
我在将页面从 Joomla 的旧站点重定向到不是 joomla 的新站点时遇到问题。这个我试过了
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^oldsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com$
RewriteRule (.*)$ http://newsite.com/$1 [R=301,L]
RewriteRule ^/page http://newsite.com/pgs/page [R=301,L]
^ this redirect to newsite.com/page instead of newsite.com/pgs/page
RewriteRule ^/anotherpage http://www.newsite.com/cat/sub/sub-sub/productindex.php [R=301,L]
^ this redirect to newsite.com/anotherpage
如您所见,它仅重定向到根/页面...没有子页面等。有人可以帮忙吗?
如果我有 2 或 3 个不同的旧网址指向相同的新网址,该怎么办?喜欢这个:
RewriteRule ^/?oldpage http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
RewriteRule ^/?oldpage2 http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
RewriteRule ^/?oldpage3 http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
【问题讨论】:
标签: apache .htaccess redirect mod-rewrite joomla