我有一个旧域名,可以称之为
example.com
我想对其所有页面及其主页进行301重定向
newsite.com
所以举个例子
example.com/category/page.html
应该301重定向到
newsite.com/category/page.html
并且
example.com should redirect to newsite.com
使用www还是不使用www
我尝试了以下
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://www.newsite.tv/$1 [L,R=301,NC]
我的文件夹结构是
index.html
.htaccess
当我进入网站时,无论是否使用通配符,它仅加载index.html,而.htaccess重定向不起作用。
我确实启用了modrewrite
任何人都可以指导我为这种情况设置正确的.htaccess。
谢谢!
您也可以使用RedirectMatch指令。
在Olddomain / .htaccess中尝试一下:
RedirectMatch ^/(.*)$ http://newsite.com/$1
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句