我最近为我在一个子域http://technotes.tostaky.biz上维护的博客设置了一个新的URL http://www.mytechnotes.biz 。
redirect在以下情况下起作用:
technotes.tostaky.biz -> www.mytechnotes.biz www.technotes.tostaky.biz -> www.mytechnotes.biz
但在这种情况下不起作用:
http://technotes.tostaky.biz/2012/11/introduction-to-css-concepts.html
然而,下面的页面存在:
www.technotes.biz/2012/11/introduction-to-css-concepts.html
我的.htaccess文件的内容是:
RewriteEngine On RewriteCond %{HTTP_HOST} ^technotes\.tostaky\.biz$ [OR] RewriteCond %{HTTP_HOST} ^www\.technotes\.tostaky\.biz$ RewriteRule ^/?$ "http\:\/\/www\.mytechnotes\.biz\/" [R=301,L]
我不是系统pipe理员。 我依靠我的主机的CPanelconfiguration,但我无法解决此问题。 任何人都知道如何解决它? 谢谢!
您的RewriteRule中的模式(匹配的东西), ^/?$明确地只匹配域的根URL。 我想你想要的是匹配任何东西,并将其包含在redirect的URL中:
RewriteRule (.*) http://www.mytechnotes.biz/$1 [R=301,L]