【发布时间】:2013-02-19 12:59:52
【问题描述】:
我知道有很多类似的问题,但是我花了2天多的时间调查它没有成功,所以你是我最后的希望)
我写了以下重写规则:
RewriteCond %{HTTPS} off [NC]
RewriteCond %{REQUEST_URI} ^((/member/settings)?/orders/?)$ [NC]
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]
RewriteRule \.(gif|jpe?g|png|css|js|eot|woff|ttf|svg)$ - [NC,L]
RewriteCond %{HTTPS} on [NC]
RewriteCond %{REQUEST_URI} !^((/member/settings)?/orders/?)$ [NC]
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [NC,QSA,L]
我希望 URL example.com/orders/ 和 example.com/member/settings/orders/ 始终重定向到 HTTPS,而所有其他 URL 都强制使用 HTTP。此外,所有查询都应转发至index.php。
而且,显然,所有媒体文件都应保持与请求相同的协议。
当我首先请求http://example.com/orders/ 时,它会重定向到https://example.com/orders/,然后第二次重定向到http://example.com/index.php?/orders/。实际上是预期的,但问题是“index.php”出现在浏览器的地址栏中。
问题是如何去掉浏览器地址栏中的'index.php'?
任何帮助将不胜感激。
【问题讨论】:
标签: http mod-rewrite https