https to http
8 posts
• Page 1 of 1
https to http
Hello,
I have been searching for a script that redirects https to http when not on https pages defined. I have been searching through searching the community and example I haven't found one that works.
Below is what I have been trying but it's only for http to https. I need the opposite and then the ability to add specific URLs that should be https.
http://www.helicontech.com/forum/13114- ... HTTPS.html
I found this one, but how do I add exceptions?
# redirect all https requests to http
RewriteCond %HTTPS (?!off).*
RewriteCond Host: (.*)
RewriteRule (.*) http\://$1$2 [I,RP]
Another from the example page
#Redirect HTTPS to non-HTTPS
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? http://%1%2 [R,L]
Thanks,
Jobu
I have been searching for a script that redirects https to http when not on https pages defined. I have been searching through searching the community and example I haven't found one that works.
Below is what I have been trying but it's only for http to https. I need the opposite and then the ability to add specific URLs that should be https.
http://www.helicontech.com/forum/13114- ... HTTPS.html
I found this one, but how do I add exceptions?
# redirect all https requests to http
RewriteCond %HTTPS (?!off).*
RewriteCond Host: (.*)
RewriteRule (.*) http\://$1$2 [I,RP]
Another from the example page
#Redirect HTTPS to non-HTTPS
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? http://%1%2 [R,L]
Thanks,
Jobu
Re: https to http
Hello, Jobu
Do you mean you want to specify specific URLs to stay https?
Please try to do it like this:
# redirect all https requests to http
RewriteCond %{HTTPS} ^(?!off).*
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} !^/url_to_stay_https [NC]
RewriteRule (.*) http\://$1$2 [R=301,L]
Do you mean you want to specify specific URLs to stay https?
Please try to do it like this:
# redirect all https requests to http
RewriteCond %{HTTPS} ^(?!off).*
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} !^/url_to_stay_https [NC]
RewriteRule (.*) http\://$1$2 [R=301,L]
Re: https to http
Hello Anton,
Thank you for your quick response. Yes, I am trying to specify specific URLs to stay https. However, is there also command that will specify specific URLs to stay https and reset other back to http when outside of the specific ones?
Note: The issue is users are hitting the https and then surfing other pages as https, when they should be http.
Thank you,
Jobu
Thank you for your quick response. Yes, I am trying to specify specific URLs to stay https. However, is there also command that will specify specific URLs to stay https and reset other back to http when outside of the specific ones?
Note: The issue is users are hitting the https and then surfing other pages as https, when they should be http.
Thank you,
Jobu
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: https to http
What you can do with Anton's rule is edit the condition he offered as the following:
How many pages do you need?
Regards
Andrew
- Code: Select all
RewriteCond %{REQUEST_URI} !^/(?:url_to_stay_https|otherURL|folder/file|folder1/folder2/file1|severalMoreURLs) [NC]
How many pages do you need?
Regards
Andrew
Re: https to http
Andrew,
I made the change but I am not seeing any results.
Thanks for asking. I only have about five URLs.
Here is the code I am using:
# redirect all https requests to http
RewriteCond %{HTTPS} ^(?!off).*
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} !^/(?:url_to_stay_https|/folder1/page.aspx|/folder2/page.aspx|/folder3/page.aspx|/folder4/page.aspx|/folder5/page.aspx) [NC]
RewriteRule (.*) http\://$1$2 [R=301,L]
Here is another one I found:
# rule 1b: prepend www to the hostname, when it is not present.
RewriteCond %{HTTP_HOST} ^(?!www\.).*website\.com$
RedirectRule ^/(.*)$ http://www.website.com/$1 [R=301]
# rule 2: exclude a few pages from any IIRF rules that appear below this one,
# including in particular the https-to-http redirection rule. The replacement
# string of dash (-) tells IIRF to "do nothing". The rule decorated with the [L]
# (last) modifier to tell IIRF - no more rules processing for this request.
RewriteRule ^/folder1/page.aspx - [L]
RewriteRule ^/folder2/page.aspx - [L]
RewriteRule ^/folder3/page.aspx - [L]
RewriteRule ^/folder4/page.aspx - [L]
RewriteRule ^/folder5/page.aspx - [L]
# rule 3: redirect to http if https is in use
RewriteCond %{SERVER_PORT} ^443$
RedirectRule ^/(.*)$ http://www.website.com/$1 [R=301]
Best,
Jobu
I made the change but I am not seeing any results.
Thanks for asking. I only have about five URLs.
Here is the code I am using:
# redirect all https requests to http
RewriteCond %{HTTPS} ^(?!off).*
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} !^/(?:url_to_stay_https|/folder1/page.aspx|/folder2/page.aspx|/folder3/page.aspx|/folder4/page.aspx|/folder5/page.aspx) [NC]
RewriteRule (.*) http\://$1$2 [R=301,L]
Here is another one I found:
# rule 1b: prepend www to the hostname, when it is not present.
RewriteCond %{HTTP_HOST} ^(?!www\.).*website\.com$
RedirectRule ^/(.*)$ http://www.website.com/$1 [R=301]
# rule 2: exclude a few pages from any IIRF rules that appear below this one,
# including in particular the https-to-http redirection rule. The replacement
# string of dash (-) tells IIRF to "do nothing". The rule decorated with the [L]
# (last) modifier to tell IIRF - no more rules processing for this request.
RewriteRule ^/folder1/page.aspx - [L]
RewriteRule ^/folder2/page.aspx - [L]
RewriteRule ^/folder3/page.aspx - [L]
RewriteRule ^/folder4/page.aspx - [L]
RewriteRule ^/folder5/page.aspx - [L]
# rule 3: redirect to http if https is in use
RewriteCond %{SERVER_PORT} ^443$
RedirectRule ^/(.*)$ http://www.website.com/$1 [R=301]
Best,
Jobu
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: https to http
Let's try to leave only the combination we've provided and enable logging.
Please, provide rewrite.log for a testing request. Logging issues are desribed in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Please, provide rewrite.log for a testing request. Logging issues are desribed in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Re: https to http
Andrew, thank you for your response. I will stick with what you suggested. I will submit my rewrite.log. Could you confirm the script that I have posted that lists my https exceptions, looks OK structurally?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: https to http
Yes, the syntax is okay.
Regards
Andrew
Regards
Andrew
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 15 guests