i'm using open-school php on my host and i'm trying to force ssl on my website but when i add this code
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
but then i'm unable to access my website as the browser says too many loops or redirects
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
here is the orignal htacess file please help
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
#Admin
Rewriterule ^admin$ index.php?r=Cms/admin/home
#Install
Rewriterule ^install$ install.php?r=Install/default
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(js|ico|gif|jpg|png|css)$
# otherwise forward it to index.php
RewriteRule . index.php
Rather than using the %{SERVER_PORT}
line, try this:
RewriteCond %{HTTPS} !=on
This is a complete .htaccess
file that I use to force any website to SSL:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.