httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Evans <>
Subject Re: [users@httpd] Rewrite Voodoo pt. 2
Date Tue, 19 Jan 2010 15:33:11 GMT
On Tue, Jan 19, 2010 at 2:47 PM, Reese <> wrote:
> Hi everyone,
> We're experiencing some difficulty that I'm not entirely sure of
> the origin of. Most URLs to content in a subdomain link through
> the subdomain, but a few are linking a subdirectory of the main
> domain instead
> domain.ext/subdirectory/content.ext (the few)
> subdomain.ext/content.ext (the many and preferred)
> So I wrote the below for inclusion in the main domain .htaccess
> file, it's off the top of my head so I'm wondering if anyone sees
> anything wrong with it and if yes, how it would be fixed (watch
> for line wrap):
> RewriteEngine On
> RewriteRule  ^(www\.)?domain\.ext/subdomain/(.*)$ subdomain\.domain\.ext/$2
> [R=301,L]
> Reese

RewriteRules operate over the part of the URL after the host and
before the query string, so you would be wanting to try out

, in particular the section labelled 'What is matched'.




Rewrite rule problems generally get solved quicker if you try and
write them yourself, turn on the RewriteLog and test them against some
sample URLs. If it doesn't work, providing that information to the
list will get you more/faster/more accurate responses.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message