RE: Rewrite Voodoo pt. 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 19 January 2010 22:24, Reese wrote:
>
> On 19-Jan-10 17:16, Peter J Milanese wrote:
> > Have to throw in something here. Tom gave you the right answers. What
> > exactly is 'one of those'?
>
> RTFM is not always the "right" answer to the question asked.

I agree, but Tom's answer was more than simply RTFM.  It was 'this is the
part of the voodoo you have misunderstood, and here is the part of the
manual which will help you to understand how this voodoo works.'

>
> My attempt was:
>
> RewriteEngine On
> RewriteRule ^(www\.)?domain\.ext/subdomain/(.*)$
> subdomain\.domain\.ext/$2 [R=301,L]
>
>
> I now think this would be better:
>
> RewriteEngine On
> RewriteRule ^domain\.ext/subdomain/(.*)$ subdomain\.domain\.ext/$2
> [R=301,L]
>

No better.

> but I don't know why. Or if it will work. Or why. I'd like to know why.

The reason why it won't work is because, as several posters (including Tom)
have already mentioned, the _RewriteRule_ will NOT be aware of the
hostname.  It matches everything AFTER the hostname.

As Tom correctly stated, YOU WILL NEED A RewriteCond to match any
hostnames.

So as a first step I would respectfully suggest you add a RewriteCond
directive immediately preceding your RewriteRule, as follows:

RewriteCond %{HTTP_HOST} ^(www\.)?domain.ext$

Then carry on with your RewriteRule voodoo, taking care to note that you
CAN NOT use the domain name in a RewriteRule.  Note that the HTTP_HOST
variable is available for your use on the right hand side of your
RewriteRule.

>
> Reese


______________________________________________________________________
This e-mail and any attached files are intended for the named addressee only. It contains information, which may be confidential and legally privileged and also protected by copyright. Unless you are the named addressee (or authorised to receive for the addressee) you may not copy or use it, or disclose it to anyone else. If you received it in error please notify the sender immediately and then delete it from your system. Please be advised that the views and opinions expressed in this e-mail may not reflect the views and opinions of Associated Newspapers Limited or any of its subsidiary companies. We make every effort to keep our network free from viruses. However, you do need to check this e-mail and any attachments to it for viruses as we can take no responsibility for any computer virus which may be transferred by way of this e-mail. Use of this or any other e-mail facility signifies consent to any interception we might lawfully carry out to prevent abuse of these faciliti
 es.
Associated Newspapers Ltd. Registered Office: Northcliffe House, 2 Derry St, Kensington, London, W8 5TT. Registered No 84121 England.

---------------------------------------------------------------------
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-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux