301 redirect for http only
10 posts
• Page 1 of 1
- jrhinehart
-
- Posts: 5
- Joined: 06 Aug 2013, 15:42
301 redirect for http only
Hi,
I'm using the example as provided in SEO section of the documentation:
RewriteCond %{HTTPS} (off)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
However, it's still rewriting the calls to port 443. Can anyone catch what is going on here? I only want traffic on port 80 to go from non www to the www site. Port 443 comes in on a different host on the same domain and not www.
Thanks!
Jason
I'm using the example as provided in SEO section of the documentation:
RewriteCond %{HTTPS} (off)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
However, it's still rewriting the calls to port 443. Can anyone catch what is going on here? I only want traffic on port 80 to go from non www to the www site. Port 443 comes in on a different host on the same domain and not www.
Thanks!
Jason
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 301 redirect for http only
Hello,
I guess in the examples the rule was using
RewriteCond %{HTTPS} (on)?
instead of
RewriteCond %{HTTPS} (off)?
Which is logically directly opposite to what we have here.
Regards
Andrew
I guess in the examples the rule was using
RewriteCond %{HTTPS} (on)?
instead of
RewriteCond %{HTTPS} (off)?
Which is logically directly opposite to what we have here.
Regards
Andrew
- jrhinehart
-
- Posts: 5
- Joined: 06 Aug 2013, 15:42
Re: 301 redirect for http only
Thanks, but I tried both ways. Any other ideas?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 301 redirect for http only
The best way is to provide us with the logs.
Logging is described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Logging is described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
- jrhinehart
-
- Posts: 5
- Joined: 06 Aug 2013, 15:42
Re: 301 redirect for http only
Thanks. Some more info, I am setting this up on our internal staging server to prove https traffic on 443 will not be rewritten, regardless of URL. We also have http:\\staging2 configured which I would expect the rewrite. Here are the log entries of me attempting to hit 'https:\\staging2' with HTTPS on and off. Thanks again.
[staging2/sid#1630489589][rid#20192920/initial] (2) init rewrite engine with requested uri /eurl.axd/355ab3934992e943adc9402ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[staging2/sid#1630489589][rid#20192920/initial] (3) applying pattern '.?' to uri '/eurl.axd/355ab3934992e943adc9402ae3f94cb8/'
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='on' pattern='(off)?' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='staging2' pattern='^(?!www\.)(.+)$' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='/eurl.axd/355ab3934992e943adc9402ae3f94cb8/' pattern='(.+)' => matched
[staging2/sid#1630489589][rid#20192920/initial] (1) escaping http://www.staging2/eurl.axd/355ab39349 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) explicitly forcing redirect with http://www.staging2/eurl.axd/355ab39349 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) internal redirect with /eurl.axd/355ab3934992e943adc9402ae3f94cb8/ [INTERNAL REDIRECT]
[staging2/sid#1630489589][rid#20192920/initial] (2) init rewrite engine with requested uri /eurl.axd/355ab3934992e943adc9402ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[staging2/sid#1630489589][rid#20192920/initial] (3) applying pattern '.?' to uri '/eurl.axd/355ab3934992e943adc9402ae3f94cb8/'
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='on' pattern='(on)?' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='staging2' pattern='^(?!www\.)(.+)$' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='/eurl.axd/355ab3934992e943adc9402ae3f94cb8/' pattern='(.+)' => matched
[staging2/sid#1630489589][rid#20192920/initial] (1) escaping https://www.staging2/eurl.axd/355ab3934 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) explicitly forcing redirect with https://www.staging2/eurl.axd/355ab3934 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) internal redirect with /eurl.axd/355ab3934992e943adc9402ae3f94cb8/ [INTERNAL REDIRECT]
[staging2/sid#1630489589][rid#20192920/initial] (2) init rewrite engine with requested uri /eurl.axd/355ab3934992e943adc9402ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[staging2/sid#1630489589][rid#20192920/initial] (3) applying pattern '.?' to uri '/eurl.axd/355ab3934992e943adc9402ae3f94cb8/'
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='on' pattern='(off)?' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='staging2' pattern='^(?!www\.)(.+)$' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='/eurl.axd/355ab3934992e943adc9402ae3f94cb8/' pattern='(.+)' => matched
[staging2/sid#1630489589][rid#20192920/initial] (1) escaping http://www.staging2/eurl.axd/355ab39349 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) explicitly forcing redirect with http://www.staging2/eurl.axd/355ab39349 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) internal redirect with /eurl.axd/355ab3934992e943adc9402ae3f94cb8/ [INTERNAL REDIRECT]
[staging2/sid#1630489589][rid#20192920/initial] (2) init rewrite engine with requested uri /eurl.axd/355ab3934992e943adc9402ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
[staging2/sid#1630489589][rid#20192920/initial] (3) applying pattern '.?' to uri '/eurl.axd/355ab3934992e943adc9402ae3f94cb8/'
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='on' pattern='(on)?' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='staging2' pattern='^(?!www\.)(.+)$' => matched
[staging2/sid#1630489589][rid#20192920/initial] (4) RewriteCond: input='/eurl.axd/355ab3934992e943adc9402ae3f94cb8/' pattern='(.+)' => matched
[staging2/sid#1630489589][rid#20192920/initial] (1) escaping https://www.staging2/eurl.axd/355ab3934 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) explicitly forcing redirect with https://www.staging2/eurl.axd/355ab3934 ... ae3f94cb8/
[staging2/sid#1630489589][rid#20192920/initial] (2) internal redirect with /eurl.axd/355ab3934992e943adc9402ae3f94cb8/ [INTERNAL REDIRECT]
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 301 redirect for http only
Hmmm... maybe it's too late at night and I didn't get something, but what's the issue? Https should be redirected to https, and httpd to http AND append http://WWW., right? Right?
I see the following parts and it seems that everything works as expected:
Regards
Andrew
I see the following parts and it seems that everything works as expected:
- Code: Select all
(4) RewriteCond: input='on' pattern='(off)?' => matched
(2) explicitly forcing redirect with http://www.staging2/eurl.axd/355ab39349 ... ae3f94cb8/
- Code: Select all
(4) RewriteCond: input='on' pattern='(on)?' => matched
(2) explicitly forcing redirect with https://www.staging2/eurl.axd/355ab3934 ... ae3f94cb8/
Regards
Andrew
- jrhinehart
-
- Posts: 5
- Joined: 06 Aug 2013, 15:42
Re: 301 redirect for http only
no, you are correct. I'm not attempting or do I want to re-direct any protocols. It is indeed staying within protocol with HTTPS (on), my issue is that I don't want anything coming in on port 443 to have its URL rewritten, only port 80. Hope that makes sense.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 301 redirect for http only
Well, it doesn't yet. Or maybe it's just me... and I need some sleep
HTTPS is by default 443 port, so maybe you could provide an example.
Regards
Andrew
HTTPS URLs begin with "https://" and use port 443 by default, whereas HTTP URLs begin with "http://" and use port 80 by default.
HTTPS is by default 443 port, so maybe you could provide an example.
Regards
Andrew
- jrhinehart
-
- Posts: 5
- Joined: 06 Aug 2013, 15:42
Re: 301 redirect for http only
OK, let me try to explain it this way:
1) If the user types 'https:\\' and then anything at all as the address, I don't want ISAPI_Rewriter to do anything...no changing, no redirecting, no nothing.
2) If the user types 'http:\\' and the next 3 characters are not www, then I want to re-write the url to prepend www.
1) If the user types 'https:\\' and then anything at all as the address, I don't want ISAPI_Rewriter to do anything...no changing, no redirecting, no nothing.
2) If the user types 'http:\\' and the next 3 characters are not www, then I want to re-write the url to prepend www.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: 301 redirect for http only
In this case lets try:
If not https, not www, than redirect to http://www....
We don't mention https at all.
Regards
Andrew
- Code: Select all
RewriteCond %{HTTPS} !^on
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http://www.%2%3 [R=301,L]
If not https, not www, than redirect to http://www....
We don't mention https at all.
Regards
Andrew
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 20 guests