2012-07-24 164 views
0

我得到了以下htaccess,尝试添加https重写/重定向 - 它不工作,任何想法我做错了什么?https重写不起作用

RewriteEngine on 
RewriteRule \.svn/ - [F] 

# rewrite traffic to HTTPS 
RewriteEngine on 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# otherwise forward it to index.php 
RewriteRule . index.php 
+0

它做什么而不是工作?除了一个额外的'RewriteEngine On',你的规则看起来是正确的。 – 2012-07-24 14:12:13

+0

好吧,它不会做任何事情...如果我把物理文件查找后的https规则,比我只是得到内部服务器错误... – 2012-07-24 14:12:48

回答

0

您的意思是在您的https重写代码后省略[L]吗?没有它,如果我请求“http://myserver.com/something”它将首先重写为“https://myserver.com/something”,但是(我相信)继续在.htaccess文件中,随后使用内部重写提供“index.php”而不实际重定向客户端。虽然如果请求的文件确实存在,我不知道Apache如何处理该文件。