需要帮助在.htaccess

时间:2017-03-01 19:01:16

标签: apache .htaccess

我有一个问题,我需要将用户重定向到来自http的https,但还需要第二条规则来将网址提供给MVC。两种规则都有效,但合并时则不然。为什么呢?

RewriteCond %{HTTP_HOST} ^pamisla\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://pamisla.com

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=$1 [QSA,L]

1 个答案:

答案 0 :(得分:0)

解决。谢谢miken32。

# force HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] 

# rewrite the url for the MVC   
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?s).*)$ index.php?_url=$1 [QSA,L]
相关问题