You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Reese <ho...@inkworkswell.com> on 2010/01/19 15:47:00 UTC

[users@httpd] Rewrite Voodoo pt. 2

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




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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Reese <ho...@inkworkswell.com>.
I suggested this:

>> RewriteEngine On
>> RewriteRule  ^(www\.)?domain\.ext/subdomain/(.*)$ subdomain\.domain\.ext/$2
>> [R=301,L]

On 19-Jan-10 10:33, Tom Evans wrote:

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

Totally opaque answer.

> See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
> , in particular the section labelled 'What is matched'.



> Cheers
> 
> Tom
> 
> PS:
> 
> 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:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 



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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Reese <ho...@inkworkswell.com>.
On 19-Jan-10 15:23, Oliver Schoenborn wrote:

> Well, I was going to make an attempt, but with that kind of attitude, doesn't feel right, regardless of how frustratring or voodoo'ish the docs are. 


My apologies to you, whether you actually make an attempt or not.
It's frustrating, when you are new at this and you get theory or
high-level text thrown at you over and over when you ask for help
at the deck-plates level. Voodoo indeed.

If you are still willing, then please help me understand the link
Tom provided and why my crude attempt at coding a solution will
not work. I've RTFM and STFW and in this place, I thought I could
find answers. not more RTFM claptrap from people who haven't walked
that mile in my shoes.

Reese


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


RE: [users@httpd] Rewrite Voodoo pt. 2

Posted by Oliver Schoenborn <sc...@cae.com>.
Reese wrote:
>
> It tells me that the part after the host (I want to change the host
> name) and the part after the query string (that I'm not using if I
> understand the usage) are tips of the iceberg. And that is the part
> I'm trying to understand. And neither Tom nor you are helping.
>
> Did I not ask how the rule might be corrected? Did I not?
>
>> Over and above the call of duty, IMO.
>
> Thank you for that input, Eric. Now please go over and above yourself.

Well, I was going to make an attempt, but with that kind of attitude, doesn't feel right, regardless of how frustratring or voodoo'ish the docs are. 

Oliver
---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Reese <ho...@inkworkswell.com>.
On 19-Jan-10 14:57, Eric Covener wrote:

> Tom pointed you to the FAQ that makes your rule appear to  be a no-op
> and even took the time to restate it in-line. 

What, this?

>> RewriteRules operate over the part of the URL after the host and
>> before the query string, so you would be wanting to try out
>> RewriteCond.
>> 
>> See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
>> , in particular the section labelled 'What is matched'.

It tells me that the part after the host (I want to change the host
name) and the part after the query string (that I'm not using if I
understand the usage) are tips of the iceberg. And that is the part
I'm trying to understand. And neither Tom nor you are helping.

Did I not ask how the rule might be corrected? Did I not?

> Over and above the call of duty, IMO.

Thank you for that input, Eric. Now please go over and above yourself.

>>  Help me understand why my suggestion above does not work, I'll
>>  learn from that. I can throw URLs at you, too.
> 
> Does interpretive dance meet your individualized educational needs?

No.

Reese




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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Eric Covener <co...@gmail.com>.
On 1/19/10, Reese <ho...@inkworkswell.com> wrote:
> > > RewriteRule  ^(www\.)?domain\.ext/subdomain/(.*)$ subdomain\.domain\.ext/$2

> > RewriteRules operate over the part of the URL after the host and
> > before the query string, so you would be wanting to try out
> > RewriteCond.
> >
>
> > See
> http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
> > , in particular the section labelled 'What is matched'.
> >
>
>  Seen it.
>
>  In case you were unclear because you weren't here earlier: I'm not
>  very good with opaque instructions like, read the incomprehensible
>  manual. Mod_rewrite is voodoo. Cool voodoo, but still voodoo and
>  no amount of RTFM will suffice when the manual is incomplete.

Tom pointed you to the FAQ that makes your rule appear to  be a no-op
and even took the time to restate it in-line.  Over and above the call
of duty, IMO.

>  Help me understand why my suggestion above does not work, I'll
>  learn from that. I can throw URLs at you, too.

Does interpretive dance meet your individualized educational needs?

-- 
Eric Covener
covener@gmail.com

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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Reese <ho...@inkworkswell.com>.
It looks like that one escaped before I was finished replying.

My apologies.


I suggested this:

>> RewriteEngine On
>> RewriteRule  ^(www\.)?domain\.ext/subdomain/(.*)$ subdomain\.domain\.ext/$2
>> [R=301,L]

On 19-Jan-10 10:33, Tom Evans wrote:

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

Okay, The issue is, links to domain.ext/subdirectoryX/ versus
to the matching sub(.*)X.domain.ext - if that makes more sense
to you.

> See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
> , in particular the section labelled 'What is matched'.

Seen it.

In case you were unclear because you weren't here earlier: I'm not
very good with opaque instructions like, read the incomprehensible
manual. Mod_rewrite is voodoo. Cool voodoo, but still voodoo and
no amount of RTFM will suffice when the manual is incomplete.

Help me understand why my suggestion above does not work, I'll
learn from that. I can throw URLs at you, too.

Reese


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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Reese <ho...@inkworkswell.com>.
On 19-Jan-10 10:33, Tom Evans wrote:

> RewriteRules operate over the part of the URL after the host and
> before the query string, so you would be wanting to try out
> RewriteCond.
> 
> See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
> , in particular the section labelled 'What is matched'.


"If you wish to match against the hostname, port, or query string, use a 
RewriteCond with the %{HTTP_HOST}, "

I'm still not seeing it.

Could any of you be less opaque - or less of a delicate flower?

I provided my best guess and asked for help. Neither "the consequent
is a result of the precedent" nor "Read here" is of help to any
except those who qualify as BoFH operators. Please don't be one of
those, it could result in this whole list getting a bad reputation.

Reese




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


Re: [users@httpd] Rewrite Voodoo pt. 2

Posted by Tom Evans <te...@googlemail.com>.
On Tue, Jan 19, 2010 at 2:47 PM, Reese <ho...@inkworkswell.com> 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
RewriteCond.

See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
, in particular the section labelled 'What is matched'.

Cheers

Tom

PS:

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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org