2016-12-16 12 views
1

助けてください.htaccessルートとindex.phpをhttpsルートにリダイレクト

HTTPルートとindex.phpをHTTPSルートにリダイレクトする方法。 スタイルとスクリプトはindex.phpと同等です。

RewriteEngine On 

RewriteRule ^(.*)/$ /$1 [L,R=301] 

# Handle Front Controller... 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

ありがとうございます!

+1

可能な重複[htaccessファイルは、httpsにリダイレクト:// WWW](http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www ) – JazZ

答えて

0

一つの方法は次のようになります。

RewriteCond %{HTTPS} off 
# First rewrite to HTTPS: 
# Don't put www. here. If it is already there it will be    included, if not 
# the subsequent rule will catch it. 
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
# Now, rewrite any request to the wrong domain to use www. 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule .* https://www.%{HTTP_HOST}%. {REQUEST_URI} [L,R=301] 
関連する問題