问题在URL重写的.htaccess
问题描述:
我试图迫使非www到www其工作作为aspected:问题在URL重写的.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
现在
如果我访问www.example.com/registration
它的伟大工程..但,当我访问相同从它的工作原理,但链接网址添加的index.php/url中是这样的:
www.example.com/index.php?/registration
我是新来的.htaccess编程..我能理解,我需要加时赛修改以下线..但我不知道如何修改这种方式,以便我不会在url中添加index.php?/
...
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
任何帮助或建议将是巨大的帮助..在此先感谢
答
交换你的规则顺序:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule^http://www.example.com%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
感谢@anubhava先生..现在,它正在完美。 – 2014-10-30 10:13:02
不客气,很高兴它解决了。 – anubhava 2014-10-30 10:22:04