<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Smart HTTP and HTTPS .htaccess Rewrite</title>
	<atom:link href="http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Wed, 18 Nov 2009 23:28:48 -0500</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sven</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-104814</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Thu, 01 Oct 2009 13:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-104814</guid>
		<description>Nice. Thanks :)</description>
		<content:encoded><![CDATA[<p>Nice. Thanks :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raystrach</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-104405</link>
		<dc:creator>raystrach</dc:creator>
		<pubDate>Thu, 24 Sep 2009 07:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-104405</guid>
		<description>i am not a htacess expert, but i would be checking all your frames, images and includes and making sure they are coming from a secure server.


then again you might have google ads which do not have the option of coming from a secure server in which case you are stuffed. other ad providers may have the option of sourcing ads from a secure server, not just an ordinary server.</description>
		<content:encoded><![CDATA[<p>i am not a htacess expert, but i would be checking all your frames, images and includes and making sure they are coming from a secure server.</p>
<p>then again you might have google ads which do not have the option of coming from a secure server in which case you are stuffed. other ad providers may have the option of sourcing ads from a secure server, not just an ordinary server.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JN</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-91639</link>
		<dc:creator>JN</dc:creator>
		<pubDate>Thu, 30 Jul 2009 06:56:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-91639</guid>
		<description>What I am trying to do is this:  If the request is coming through &lt;code&gt;https&lt;/code&gt;, I&#039;d like all the internal content to ensure that it has https in it... This is mainly to get rid of that stupid &lt;em&gt;IE 8 security warning&lt;/em&gt; about site containing non secure items which is bs...

Any ideas?</description>
		<content:encoded><![CDATA[<p>What I am trying to do is this:  If the request is coming through <code>https</code>, I&#8217;d like all the internal content to ensure that it has https in it&#8230; This is mainly to get rid of that stupid <em>IE 8 security warning</em> about site containing non secure items which is bs&#8230;</p>
<p>Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raystrach</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-72435</link>
		<dc:creator>raystrach</dc:creator>
		<pubDate>Thu, 30 Apr 2009 00:56:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-72435</guid>
		<description>Thanks for posting this. It helped me out a great deal with having non-secure domains pointing to sub domains on my secure domain.

However, I started to have problems logging in from certain pages (there was no apparent pattern) and i discovered my form post requests were being lost. I tried for hours trying to see why the form would not process until i realized that it was probably something in &lt;code&gt;htaccess&lt;/code&gt;.

Although i really don&#039;t know exactly what the syntax means, (i am no htaccess expert) the following code looked suspicious 

&lt;pre&gt;RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http%{ENV:smartspace}://%{HTTP_HOST}/$1 [R=301,L]&lt;/pre&gt;

Sure enough, I removed the code and it worked! It must have been stripping the post variables out as well as the index name in redirecting the page.  Now it all seems to be working well (obviously it is not redirecting to the plain directory, but that&#039;s ok).  I will keep you posted if I have stuffed something else up but have not yet discovered it.

Someone might like to tell me exactly why the post variables are disappearing because it worked when I switched the method to &lt;code&gt;GET&lt;/code&gt;.

cheers</description>
		<content:encoded><![CDATA[<p>Thanks for posting this. It helped me out a great deal with having non-secure domains pointing to sub domains on my secure domain.</p>
<p>However, I started to have problems logging in from certain pages (there was no apparent pattern) and i discovered my form post requests were being lost. I tried for hours trying to see why the form would not process until i realized that it was probably something in <code>htaccess</code>.</p>
<p>Although i really don&#8217;t know exactly what the syntax means, (i am no htaccess expert) the following code looked suspicious </p>
<pre>RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http%{ENV:smartspace}://%{HTTP_HOST}/$1 [R=301,L]</pre>
<p>Sure enough, I removed the code and it worked! It must have been stripping the post variables out as well as the index name in redirecting the page.  Now it all seems to be working well (obviously it is not redirecting to the plain directory, but that&#8217;s ok).  I will keep you posted if I have stuffed something else up but have not yet discovered it.</p>
<p>Someone might like to tell me exactly why the post variables are disappearing because it worked when I switched the method to <code>GET</code>.</p>
<p>cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lrwing</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-63702</link>
		<dc:creator>lrwing</dc:creator>
		<pubDate>Wed, 11 Feb 2009 13:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-63702</guid>
		<description>I dont understand this line, i dont know how to interpret it. Can you please explain how to read this?

&lt;pre&gt;RewriteCond %{SERVER_PORT}s ^(443(s)&#124;[0-9]+s)$&lt;/pre&gt;

</description>
		<content:encoded><![CDATA[<p>I dont understand this line, i dont know how to interpret it. Can you please explain how to read this?</p>
<pre>RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tung</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46228</link>
		<dc:creator>Tung</dc:creator>
		<pubDate>Wed, 22 Oct 2008 05:09:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46228</guid>
		<description>OK! My fault is the .htaccess rules work on the wrong scope. 
And the solution is as follows:

Put the following rules inside  of httpd-ssl.conf
&lt;pre&gt;
RewriteEngine on
RewriteCond %{HTTPS} =on
RewriteRule ^/repos$ /repos/ [R]
&lt;/pre&gt;
Then browsing &lt;code&gt;https://hostname/repos&lt;/code&gt; will be directed to &lt;code&gt;https://hostname/repos/&lt;/code&gt;

Where is the global area that rewrite rules will take effect on http and https both ?</description>
		<content:encoded><![CDATA[<p>OK! My fault is the .htaccess rules work on the wrong scope.<br />
And the solution is as follows:</p>
<p>Put the following rules inside  of httpd-ssl.conf</p>
<pre>RewriteEngine on
RewriteCond %{HTTPS} =on
RewriteRule ^/repos$ /repos/ [R]</pre>
<p>Then browsing <code>https://hostname/repos</code> will be directed to <code>https://hostname/repos/</code></p>
<p>Where is the global area that rewrite rules will take effect on http and https both ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tung</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46196</link>
		<dc:creator>Tung</dc:creator>
		<pubDate>Mon, 20 Oct 2008 11:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46196</guid>
		<description>Hello,

My goal is to redirect &#039;https://hostname/repos&#039; to &#039;https://hostname/repos/&#039; on &lt;strong&gt;Apache 2.2&lt;/strong&gt;
I try a lot of methods, but I can&#039;t do it.

&lt;pre&gt;
RewriteEngine on
# rewrite &#039;/repos&#039; to &#039;/repos/&#039;
# These two rules both work with http only, not with https.
#RewriteRule ^(/repos)$ $1/ [R]  #(/repos) means group, $1 = /repos
#RewriteRule ^/repos$ /repos/ [R]
&#160;
# redirect &#039;http://hostname/repos[/&#46;..]&#039; to https
RewriteCond %{HTTPS} !=on
RewriteRule ^/repos$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R]
RewriteRule ^/repos/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
&#160;
# Notice: &#039;https://hostname/repos/&#039; is our goal
# (1)Redirecting &#039;http://hostname/repos&#039; to &#039;http://hostname/repos/&#039; is skip
# (2)Redirecting &#039;http://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is OK (done)
# (3)Redirecting &#039;http://hostname/repos/&#039; to &#039;https://hostname/repos/&#039; is OK (done)
# (4)Redirecting &#039;http://hostname/repos/&#46;..&#039; to &#039;https://hostname/repos/&#46;..&#039; is OK (done)
&#160;
# (5)Redirecting &#039;https://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is fail
#  it can&#039;t add a slash at last
#RewriteCond %{HTTPS} =on
#RewriteRule ^/repos$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R]
&#160;
# (5)Redirecting &#039;https://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is fail
#  it can&#039;t add a slash at last
#RewriteCond %{HTTPS} =on  #and
#RewriteCond %{THE_REQUEST} ^GET\ /repos\ HTTP/
#RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R=301]
&#160;
# So browsing &#039;https://hostname/repos&#039; will return &#039;404 Not Found&#039; 
&lt;/pre&gt;

DO you have any good idea? Thank you!</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>My goal is to redirect &#8216;https://hostname/repos&#8217; to &#8216;https://hostname/repos/&#8217; on <strong>Apache 2.2</strong><br />
I try a lot of methods, but I can&#8217;t do it.</p>
<pre>RewriteEngine on
# rewrite &#039;/repos&#039; to &#039;/repos/&#039;
# These two rules both work with http only, not with https.
#RewriteRule ^(/repos)$ $1/ [R]  #(/repos) means group, $1 = /repos
#RewriteRule ^/repos$ /repos/ [R]
&nbsp;
# redirect &#039;http://hostname/repos[/&#46;..]&#039; to https
RewriteCond %{HTTPS} !=on
RewriteRule ^/repos$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R]
RewriteRule ^/repos/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
&nbsp;
# Notice: &#039;https://hostname/repos/&#039; is our goal
# (1)Redirecting &#039;http://hostname/repos&#039; to &#039;http://hostname/repos/&#039; is skip
# (2)Redirecting &#039;http://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is OK (done)
# (3)Redirecting &#039;http://hostname/repos/&#039; to &#039;https://hostname/repos/&#039; is OK (done)
# (4)Redirecting &#039;http://hostname/repos/&#46;..&#039; to &#039;https://hostname/repos/&#46;..&#039; is OK (done)
&nbsp;
# (5)Redirecting &#039;https://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is fail
#  it can&#039;t add a slash at last
#RewriteCond %{HTTPS} =on
#RewriteRule ^/repos$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R]
&nbsp;
# (5)Redirecting &#039;https://hostname/repos&#039; to &#039;https://hostname/repos/&#039; is fail
#  it can&#039;t add a slash at last
#RewriteCond %{HTTPS} =on  #and
#RewriteCond %{THE_REQUEST} ^GET\ /repos\ HTTP/
#RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}/ [L,R=301]
&nbsp;
# So browsing &#039;https://hostname/repos&#039; will return &#039;404 Not Found&#039; </pre>
<p>DO you have any good idea? Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tung</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46181</link>
		<dc:creator>Tung</dc:creator>
		<pubDate>Sun, 19 Oct 2008 18:55:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-46181</guid>
		<description>I want to redirect &#039;https://hostname/mypath&#039; to &#039;https://hostname/mypath/&#039; (add a slash)
on Apache 2.2

But the following rule works with http only, not https.
&lt;pre&gt;
RewriteEngine on
RewriteRule ^/mypath$ /mypath/ [R]
&lt;/pre&gt;
Any idea?</description>
		<content:encoded><![CDATA[<p>I want to redirect &#8216;https://hostname/mypath&#8217; to &#8216;https://hostname/mypath/&#8217; (add a slash)<br />
on Apache 2.2</p>
<p>But the following rule works with http only, not https.</p>
<pre>RewriteEngine on
RewriteRule ^/mypath$ /mypath/ [R]</pre>
<p>Any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos M.S.</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-45944</link>
		<dc:creator>Carlos M.S.</dc:creator>
		<pubDate>Mon, 06 Oct 2008 18:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-45944</guid>
		<description>Hello, I have migrated a &lt;strong&gt;moodle https site to a new moodle http site&lt;/strong&gt; and I need to change/rewrite all the links to &lt;pre&gt;https:// to http://&lt;/pre&gt; How can i do it?</description>
		<content:encoded><![CDATA[<p>Hello, I have migrated a <strong>moodle https site to a new moodle http site</strong> and I need to change/rewrite all the links to
<pre>https:// to http://</pre>
<p> How can i do it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anthylon</title>
		<link>http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-45915</link>
		<dc:creator>anthylon</dc:creator>
		<pubDate>Sun, 05 Oct 2008 14:22:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html#comment-45915</guid>
		<description>Hello,

I have multiple domain on my single shared account (monsterhost). It works fine but I am having small issue. Lets say my main domain is mydomain.com. Each domain is pointing to separated subfolder (example: myseconddomain.com is pointing to mydomain.com/myseconddomain/). It is all working well but I wish to block all access for requests like this: mydomain.com/myseconddomain/.

Please, advise.

Thank you.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I have multiple domain on my single shared account (monsterhost). It works fine but I am having small issue. Lets say my main domain is mydomain.com. Each domain is pointing to separated subfolder (example: myseconddomain.com is pointing to mydomain.com/myseconddomain/). It is all working well but I wish to block all access for requests like this: mydomain.com/myseconddomain/.</p>
<p>Please, advise.</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
