.htaccess 301将任何页面重定向到一个特定页面
有没有一种方法可以通过htaccess 301重定向将域上的任何页面重定向到另一个域上的特定页面 例如,我被.htaccess 301将任何页面重定向到一个特定页面,.htaccess,.htaccess,有没有一种方法可以通过htaccess 301重定向将域上的任何页面重定向到另一个域上的特定页面 例如,我被domain.com/index.html和domain.com/contact.html重定向到newsite.com/index.html 但我想这样做,而不必列出每一页的具体内容 我的301重定向能像这样吗 301 * http://newsite.com/index.html 或者应该如何设置。不幸的是,我没有mod rewrite的访问权限,因此我无法使用mod rewrite
domain.com/index.html
和domain.com/contact.html
重定向到newsite.com/index.html
但我想这样做,而不必列出每一页的具体内容
我的301重定向能像这样吗
301 * http://newsite.com/index.html
或者应该如何设置。不幸的是,我没有mod rewrite的访问权限,因此我无法使用mod rewrite来使其工作。是的,这是可能的——您需要使用mod_alias来代替mod_rewrite(它有更多的机会被启用)
这将把一切重定向到newsite.com/
RedirectMatch 301 ^/(.*)$ http://newsite.com/index.html
这一个将把所有内容重定向到另一个域上的同一路径:(例如,oldsite.com/meow.php
=>newsite.com/meow.php
)
在使用wordpress并试图从页面中删除所有.asp扩展名时,出现了与此类似的问题,这可以粘贴到我的.htaccess文件的顶部
## 301 Redirects
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1? [R=301,NE,NC,L]
## 301 Redirects
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1? [R=301,NE,NC,L]