3
我有一个旧网址(test.me.com
),我想将其重定向到www.me.com
。在.htaccess中重定向https和http
所以我加入这行到我的.htaccess文件:
RewriteRule ^(.*)$ http://www\.me\.com/$1 [L,R=301]
但事实证明,谷歌已经收录一些页面。由于我有SSL证书,完整的网址是https://test.me.com
。所以上面的重定向不会影响https
文件...
我试过这个,但没有运气。
RewriteCond %{HTTPS} =on
RewriteRule ^(.+)$ - [env=ps:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.+)$ - [env=ps:http]
# redirect urls with index.html to folder
RewriteCond %{HTTP_HOST} ^test.me.com [NC]
RewriteRule ^.*$ %{ENV:ps}://www.me.com/%1 [R=302,L]
如何配置这两个http://test.me.com
和https://www.test.com
被重定向到http://www.me.com
我的.htaccess文件?
谢谢您的回答。但不应该在你的替代解决方案中的第二行是这样的:'RewriteCond%{HTTP_HOST}!^ test \ .me \ .com $ [NC]' – Michiel 2012-02-29 10:37:04
nope。 。 。 。 。 。 – Gerben 2012-02-29 11:55:32
'test.me.com'在哪里被重定向? – Michiel 2012-02-29 12:35:46