URL重写htaccess问题
问题描述:
是一个相当新的htaccess重定向这个世界。他试图强制我的Zend MVC中的所有重定向到我的https,但我得到一个请求的URL未找到错误的请求,控制器URL重写htaccess问题
例
https://www.example.com/auth/register
给出请求的URL/AUTH /注册未找到错误。但是,如果我删除了https重定向规则,它可以正常使用http。如果我将网址调整为
https://www.example.com/index.php/auth/register
它工作正常。 的URL
https://www.example.com/index/faq
作品就好了,因为它通过索引控制器。
我的.htaccess文件看起来像这样
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
什么我需要调整,以获得URL
https://www.example.com/auth/register
工作?
答
您的代码显示为“如果此项匹配文件,链接或目录,则不做任何操作并继续。”您需要跳过最后重写规则在文件中实际存在的情况下:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=1,NC,L]
RewriteRule ^.*$ index.php [NC,L]
+0
没有变化的https:// WWW。 example.com/auth/register仍然会引发相同的错误 – davykiash 2010-04-29 19:04:28
发现我的疑难问题。didnt通过端口指定SSL请求国防部重写规则443 – davykiash 2010-08-05 17:09:48