2016-07-29 89 views
0

我想将所有流量重定向到主页,除了任何具有/ google /目录的东西。我想保留默认的Wordpress重写,以便index.php被删除。将所有流量重定向到主页,除了一页以外

# Need to leave certain files alone 
RewriteCond %{REQUEST_URI} !.(gif|jpeg|png|css|js|woff|ttf|eot|svg|otf|woff2|jpg)$ 

# No redirects on home page (obviously) 
http://example.com 

# Everything else should redirect back to http://example.com (home) 
http://example.com/* 

# All variations of the following should NOT redirect 
http://example.com/google/ 
http://example.com/google 
http://example.com/google/index.php 

谢谢!

回答

0

您必须使用此规则来实现您的用例。

RewriteRule !^google($|/) http://example.com%{REQUEST_URI} [L,R=301] 
+0

什么是与默认WP规则结合使用?我尝试了类似的规则,并导致重定向循环。如果它有效,我会给这个镜头并标记为答案。谢谢 – DeFeNdog

相关问题