简体   繁体   English

使用htaccess将每个页面重定向到除索引页面之外的其他域

[英]Redirect every page to another domain besides index page with htaccess

How can I redirect every page to another domain besides index page. 如何将每个页面重定向到除索引页面之外的另一个域。 In my case index.html, every other page mydomain/page2.html, mydomain.com/subfolder/subdolder/page.html etc to www.google.com. 以我的index.html为例,每隔一页mydomain / page2.html,mydomain.com / subfolder / subdolder / page.html等都指向www.google.com。

Right now I have something like this, but then everything will get redirected. 现在我有类似的东西,但是随后一切都会重定向。 I would like to leave only leave index.html on root untouched. 我只想保留root上的index.html不变。

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http:/www.google.com [R=301,L]
</IfModule>

Use this rule: 使用以下规则:

RewriteEngine on
RewriteRule !(^|/)index\.html http:/www.google.com [R=301,L,NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM