httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Alderman <salderm...@udayton.edu>
Subject Re: [users@httpd] Redirect HTTP to HTTPS does not work (mod_rewrite)
Date Tue, 16 Apr 2013 14:48:16 GMT
Assuming there is additional URL coming after /dashboard when the server
sends you the login page...

e.g. /dashboard/login.php

...Your redirect will not match with the $ at the end of the condition...

RewriteRule ^/dashboard$ https://%{HTTP_HOST}/dashboard [R=301,L]

says <beginning of line>/dashboard<end of line>, so /dashboard/login.php
(or whatever additional path elements there may be) will not match.

Perhaps try:

RewriteRule ^/dashboard https://%{HTTP_HOST}/dashboard [R=301,L]

Or:

RewriteRule ^/dashboard(.*)$ https://%{HTTP_HOST}/dashboard$1 [R=301,L]

On Tue, Apr 16, 2013 at 10:33 AM, Felipe Roman <roman.felipe@gmail.com>wrote:

> On Tue, Apr 16, 2013 at 10:07 AM, Igor Cicimov <icicimov@gmail.com> wrote:
>
>> There shouldnt be empty line between these two.
>>
> Hi Igor,
>
> In the conf file there isn't empty line between then:
>
> RewriteCond %{HTTPS} !=on
> RewriteRule ^/dashboard$ https://%{HTTP_HOST}/dashboard [R=301,L]
>
> and I got the same problem after the redirect. I'm going to create a
> Virtualhost for this site and test using RedirectSSL, something like:
>
> NameVirtualHost *:80
> <VirtualHost *:80>
>    ServerName mysite.example.com
>    DocumentRoot /usr/local/apache2/htdocs
> *   Redirect permanent /secure https://mysite.example.com/secure*
> </VirtualHost>
>
> and see what happens.
>
> Thanks again
>
> --
> Best Regards,
> Felipe Roman
> LinkedIn http://au.linkedin.com/in/feliperoman
>

Mime
View raw message