|
Home > Archive > Apache Server configuration support > January 2007 > Rewriting URL to include https
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Rewriting URL to include https
|
|
| laredotornado@zipmail.com 2007-01-25, 1:39 am |
| Hi,
Using Apache 2.0, how would I construct an .htaccess file that would
redirect the page visit if the URL began with "http://" to "https://".
Thus, if someone typed in
http://mydomain.com/admin/
they'd be redirected to
https://mydomain.com/admin/
? Thanks, - Dave
| |
|
| On Thu, 25 Jan 2007 05:43:16 +0100, laredotornado@zipmail.com =
<laredotornado@zipmail.com> wrote:
> Hi,
>
> Using Apache 2.0, how would I construct an .htaccess file that would
> redirect the page visit if the URL began with "http://" to "https://".=
> Thus, if someone typed in
>
> http://mydomain.com/admin/
>
> they'd be redirected to
>
> https://mydomain.com/admin/
See this url for conditional rewriting:
http://httpd.apache.org/docs/1.3/mo...tml#RewriteCond
RewriteCond ${SERVER_PROTOCOL} !^https [NC]
RewriteRule .* https://${HTTP_HOST}${REQUEST_URI} [L,R=3D301,QSA]
Grtz,
-- =
Rik Wasmus
* I'm testing several new newsreaders at the moment. Please excuse =
possible errors and weird content. *
| |
| laredotornado@zipmail.com 2007-01-25, 7:27 pm |
| Hi,
I added your code to my .htaccess file ...
AuthType Basic
AuthUserFile "/home/remanr/www/www/admin/.htpasswd"
AuthName Limited!
require valid-user
RewriteEngine On
RewriteCond ${SERVER_PROTOCOL} !^https [NC]
RewriteRule .* https://${HTTP_HOST}${REQUEST_URI} [L,R=301,QSA]
but when I uploaded it, I got a page not found error when I entered the
URL. I was actually redirected to Google with a
"${http_host}${request_uri}" in the search string. Any ideas? -
On Jan 25, 5:00 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 25 Jan 2007 05:43:16 +0100, laredotorn...@zipmail.com
>
> <laredotorn...@zipmail.com> wrote:
>
>
>
>
>
> RewriteCond ${SERVER_PROTOCOL} !^https [NC]
> RewriteRule .* https://${HTTP_HOST}${REQUEST_URI} [L,R=301,QSA]
>
> Grtz,
> --
> Rik Wasmus
> * I'm testing several new newsreaders at the moment. Please excuse
> possible errors and weird content. *
| |
|
| On Thu, 25 Jan 2007 20:52:37 +0100, laredotornado@zipmail.com =
<laredotornado@zipmail.com> wrote:
> Hi,
>
> I added your code to my .htaccess file ...
>
>
> AuthType Basic
> AuthUserFile "/home/remanr/www/www/admin/.htpasswd"
> AuthName Limited!
> require valid-user
>
> RewriteEngine On
> RewriteCond ${SERVER_PROTOCOL} !^https [NC]
> RewriteRule .* https://${HTTP_HOST}${REQUEST_URI} [L,R=3D301,QSA]
>
>
> but when I uploaded it, I got a page not found error when I entered th=
e
> URL. I was actually redirected to Google with a
> "${http_host}${request_uri}" in the search string. Any ideas? -
Je m'excuse, was heavy into php at that moment, The $ should be %:
RewriteCond %{SERVER_PROTOCOL} !^https [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=3D301,QSA]
-- =
Rik Wasmus
* I'm testing several new newsreaders at the moment. Please excuse =
possible errors and weird content. *
| |
| laredotornado@zipmail.com 2007-01-26, 7:27 pm |
| Thanks for the reply. Unfortunately, I still get the error (on PC
Firefox)
The page isn't redirecting properly
when I type in "mydomain.com/admin" after uploading the new .htaccess
file
AuthType Basic
AuthUserFile "/home/remanr/www/www/admin/.htpasswd"
AuthName Limited!
require valid-user
RewriteEngine On
RewriteCond %{SERVER_PROTOCOL} !^https [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
- Dave
On Jan 25, 1:57 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 25 Jan 2007 20:52:37 +0100, laredotorn...@zipmail.com
>
>
>
> <laredotorn...@zipmail.com> wrote:
>
>
>
>
>
> RewriteCond %{SERVER_PROTOCOL} !^https [NC]
> RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
> --
> Rik Wasmus
> * I'm testing several new newsreaders at the moment. Please excuse
> possible errors and weird content. *
| |
|
| laredotornado@zipmail.com <laredotornado@zipmail.com> wrote:
Please do not toppost.
=
[vbcol=seagreen]
[vbcol=seagreen]
>
> The page isn't redirecting properly
>
> when I type in "mydomain.com/admin" after uploading the new .htaccess
> file
Yes, when you type in that, then what happens??? Hwt is the error you ge=
t?
Maybe you should enable a RewriteLog so we can follow it.
> AuthType Basic
> AuthUserFile "/home/remanr/www/www/admin/.htpasswd"
> AuthName Limited!
> require valid-user
>
> RewriteEngine On
> RewriteCond %{SERVER_PROTOCOL} !^https [NC]
> RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=3D301,QSA]
Works OK here, alternatively try:
RewriteCond %{HTTPS} !^on [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=3D301,QSA]
-- =
Rik Wasmus
|
|
|
|
|