简体   繁体   中英

The page isn't redirecting properly - HTTPS HTACCESS rewrite error

I have this following htaccess rewrite rules

The rule1 is causing the infinite loop error. I am trying to redirect all the request to HTTPS but it's not working.

Because of the rule1 the rule2 is also blocked. When I comment on rule1 everything is fine.

If I change the order also this infinite loop error occurs.

Please help me how to resolve this error

RewriteEngine On
RewriteBase /

#Rule 1: Rewrite all the requests to HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

//Rule 2: redirect to the account closed setup
RewriteRule ^(?:abcd)/A-Report/(.+)$ /closed/$1 [NC,L]

Thanks in advance.

Based on this question .

RewriteEngine on

# Check for POST Submission | 
# Because POST parameters aren't retained on a redirect.
# You can omit that line if you want to make sure that all POST submissions are secure   
# (any unsecured POST submissions will be ignored)
RewriteCond %{REQUEST_METHOD} !^POST$

# Forcing HTTPS
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{SERVER_PORT} 80
# Pages to Apply
RewriteCond %{REQUEST_URI} ^something_secure [OR]
RewriteCond %{REQUEST_URI} ^something_else_secure
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM