2014-08-27 48 views
0

我无法得到这个工作:的.htaccess rediret(匹配的网址格式,重定向到页)

这是原来的URL模式:

  • /supportcp/index.html
  • /supportcp/content/edit.html
  • /supportcp/members/user_banning.html
  • /supportcp/*

所有应该重定向到/支持

我开始用下面的.htaccess代码但不幸的是我结束了错误的URL。

RewriteCond %{QUERY_STRING} !="" 
RewriteCond %{QUERY_STRING} !page=supportcp 
RewriteRule ^index.php /support/ [R,L] 

结果:?/支持/ /支持/(错误)

帮助是非常感谢!

回答

1

您需要添加?目标URI去掉所有的查询字符串:

RewriteEngine On 
RewriteBase/

# Removes index.php from ExpressionEngine URLs 
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] 
RewriteCond %{REQUEST_URI} !/system/.* [NC] 
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] 

RewriteCond %{THE_REQUEST} /index\.php [NC] 
RewriteCond %{QUERY_STRING} !="" 
RewriteCond %{QUERY_STRING} !page=supportcp 
RewriteRule ^index\.php$ /support/? [R,NC,L] 

# Directs all EE web requests through the site index file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L] 
+0

感谢您的帮助!它看起来像这样做的伎俩。但是,现在我遇到了一个重定向循环。以下是我的.htaccess文件的其余部分:https://gist.github.com/franzos/c9b0ba318e3c4739aec2(对不起,我无法在此粘贴。) – Franz 2014-08-27 13:35:59

+0

在您的答案中检查完整的.htaccess。 – anubhava 2014-08-27 13:41:59