Use HTTP_HOST instead SERVER_NAME

RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [R,L]

The SERVER_NAME is the variable you set up in the httpd.conf file
where HTTP_HOST is the variable from the client request.

On 6/16/09, Justin Pasher <just...@newmediagateway.com> wrote:
> Bob Linkonij wrote:
>> Ok, so I changed
>>
>>    RewriteCond %{HTTPS} !=on
>> -  RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [R,L]
>> +   RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
>>
>> in the .htaccess file.
>>
>> But still when I go to
>>
>>   http://Domain.com/subdirectory
>>
>> I get redirected to
>>
>>   https://Domain.com
>>
>
> Hmmm... I'm not seeing anything obvious (this is the same type of code I
> use to redirect URLs on my servers, albeit based upon the host name
> provider, not HTTP vs HTTPS). I normally set this kind of thins inside
> the apache conf (in the VirtualHost container) because rewrite rules
> work slightly different in apache conf vs .htaccess, but it shouldn't be
> affecting this situation.
>
> A couple of things to try:
>
> 1) Change the RewriteRule to this (just to make sure it's really
> processing and matching it)
>
> RewriteRule (.*) https://%{SERVER_NAME}/this-page-is-bad [R,L]
>
> 2) Try cranking up the RewriteLogLevel a bit to see the rewrites in
> action, once again to make sure it's processing properly.
>
> 3) Make sure you clear your browser cache. I've seen odd instances where
> a browser might cache a redirect.
>
>
> --
> Justin Pasher
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>    "   from the digest: users-digest-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to