You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathan-Marc Lapointe <jm...@ccdmd.qc.ca> on 2013/12/11 20:24:51 UTC

[users@httpd] mod_rewrite config

Hi,

I'd like to redirect all traffic going to https://www.mywebsite.com to
https://store.mywebsite.com instead.

But I want traffic going to http://www.mywebsite.com to be left alone.

I tried with the following config:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.mywebsite.com$ [NC]
RewriteCond %{HTTPS} =on
RewriteRule ^/?(.*) https://store.mywebsite.com/$1 [R,L]

But it does not work.

Traffic going to https://www.mywebsite.com is not rewritten to
https://store.mywebsite.com.

What am I doing wrong ?

Thanx !


CCDMD 20 ans !

Jonathan-Marc Lapointe
Technicien en informatique,
Administrateur système,
Administrateur réseau

Centre collégial de développement de matériel didactique
6220, rue Sherbrooke Est, bureau 404
Montréal (Québec) H1N 1C1
(514) 864-8928
www.ccdmd.qc.ca <http://www.ccdmd.qc.ca>
jmlapointe@ccdmd.qc.ca <ma...@ccdmd.qc.ca>
Skype: jmlccdmd

Re: [users@httpd] mod_rewrite config (UNCLASSIFIED)

Posted by Nick Tkach <nt...@gmail.com>.
I'd suggest enabling RewriteLog and setting a RewriteLogLevel to something
like debug. So something like

RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel debug

Be careful though! If this site is live and gets a lot of traffic a debug
rewrite log is going to grow fast!  That should at least give you a clear
picture of what's actually happening.  Usually I've found that the rules
just aren't working the way I thought they were.


On Wed, Dec 11, 2013 at 2:12 PM, Folino, Nick E CTR USARMY HRC (US) <
nick.e.folino.ctr@mail.mil> wrote:

> Classification: UNCLASSIFIED
> Caveats: FOUO
>
> Use redirect instead:
>
> http://httpd.apache.org/docs/current/rewrite/avoid.html
>
>
> Nick
>
>
> -----Original Message-----
> From: Jonathan-Marc Lapointe [mailto:jmlapointe@ccdmd.qc.ca]
> Sent: Wednesday, December 11, 2013 2:25 PM
> To: users@httpd.apache.org
> Subject: [users@httpd] mod_rewrite config
>
> Hi,
>
> I'd like to redirect all traffic going to https://www.mywebsite.com to
> https://store.mywebsite.com instead.
>
> But I want traffic going to http://www.mywebsite.com to be left alone.
>
> I tried with the following config:
>
> RewriteEngine On
>
> RewriteCond %{HTTP_HOST} ^www.mywebsite.com$ [NC] RewriteCond %{HTTPS}
> =on RewriteRule ^/?(.*) https://store.mywebsite.com/$1 [R,L]
>
> But it does not work.
>
> Traffic going to https://www.mywebsite.com is not rewritten to
> https://store.mywebsite.com.
>
> What am I doing wrong ?
>
> Thanx !
>
>
>
> CCDMD 20 ans !
>
> Jonathan-Marc Lapointe
> Technicien en informatique,
> Administrateur système,
> Administrateur réseau
>
> Centre collégial de développement de matériel didactique 6220, rue
> Sherbrooke Est, bureau 404 Montréal (Québec) H1N 1C1
> (514) 864-8928
> www.ccdmd.qc.ca
> jmlapointe@ccdmd.qc.ca
> Skype: jmlccdmd
>
>
> Classification: UNCLASSIFIED
> Caveats: FOUO
>
>
>

RE: [users@httpd] mod_rewrite config (UNCLASSIFIED)

Posted by "Folino, Nick E CTR USARMY HRC (US)" <ni...@mail.mil>.
Classification: UNCLASSIFIED
Caveats: FOUO

Use redirect instead:

http://httpd.apache.org/docs/current/rewrite/avoid.html


Nick


-----Original Message-----
From: Jonathan-Marc Lapointe [mailto:jmlapointe@ccdmd.qc.ca] 
Sent: Wednesday, December 11, 2013 2:25 PM
To: users@httpd.apache.org
Subject: [users@httpd] mod_rewrite config

Hi,

I'd like to redirect all traffic going to https://www.mywebsite.com to https://store.mywebsite.com instead.

But I want traffic going to http://www.mywebsite.com to be left alone.

I tried with the following config:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.mywebsite.com$ [NC] RewriteCond %{HTTPS} =on RewriteRule ^/?(.*) https://store.mywebsite.com/$1 [R,L]

But it does not work.

Traffic going to https://www.mywebsite.com is not rewritten to https://store.mywebsite.com.

What am I doing wrong ?

Thanx !



CCDMD 20 ans !

Jonathan-Marc Lapointe
Technicien en informatique,
Administrateur système,
Administrateur réseau

Centre collégial de développement de matériel didactique 6220, rue Sherbrooke Est, bureau 404 Montréal (Québec) H1N 1C1
(514) 864-8928
www.ccdmd.qc.ca
jmlapointe@ccdmd.qc.ca
Skype: jmlccdmd


Classification: UNCLASSIFIED
Caveats: FOUO