【发布时间】:2010-04-29 16:40:01
【问题描述】:
我对这个 htaccess 重定向世界相当陌生。我试图将 Zend MVC 中的所有重定向强制到我的 https,但在未通过索引的请求上出现 requested URL not found 错误控制器
例子
https://www.example.com/auth/register
给出一个请求的 URL /auth/register 未找到错误。但是,如果我删除 https 重定向规则,它可以在 http 上正常工作。如果我将 URL 调整为
https://www.example.com/index.php/auth/register
它工作正常。 网址
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>
获取网址需要做些什么调整
https://www.example.com/auth/register
工作吗?
【问题讨论】:
-
发现了我的问题。我没有为通过端口 443 的 SSL 请求指定 mod-rewrite 规则。
标签: .htaccess mod-rewrite url-rewriting