httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reese <howel...@inkworkswell.com>
Subject Re: [users@httpd] Rewrite Voodoo pt. 2
Date Sat, 23 Jan 2010 13:50:44 GMT
Apologies for the delay in responding to this, I've been busy.

On 20-Jan-10 07:13, Oliver Schoenborn wrote:

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

Dang. It's moot as far as the client is concerned, pt 1 finished my
contractual obligations for that client. Pt 2 was for my own
edification.

> You guys are very patient in answering this Reese fellow!

Well, I've been called a whole lot of things, but I think that's the
first time I've been called a fellow. I'll mark my calendar.  ;)

> Can you interpret:
> 
> rewriteCond $(HOST_NAME) ^(.*)\.domain\.ext

Condition, proceed for host_name matching (anySubdomain).domain.ext

> rewriteRule ^(.*)$ $(HOST_NAME)$1

Rule, I'm not sure what it does. Based on the link Tom posted, I'd
guess that it takes everything after domain.ext and appends it after
domain.ext - which would take an incoming URI request and output the
URI unchanged. But that's my guess. I don't *know* what it does for
sure. I could create a sandbox and test, but somehow that seems like
it would be cheating.

> rewriteRule ^([a-z])(.*)([0-9])\.domain\.ext(.*) www$3.domain.ext/$2_$1$4

Rule,
lowercase-alpha saved as $1
plus
zero or more of everything saved as $2
plus
0-9 numeric saved as $3
plus
domain.ext
plus
zero or more of anything saved as $4

rewrite to
www$3.domain.ext/$2_$1$4

In the case of www.domain.ext/subdomain/file220110.html this would
result in a severely fractured URL I think.

> What will it do to the following HTTP requests:

Oh wow. Here we go. For URI's that match host_name:

rewriteRule ^([a-z])(.*)([0-9])\.domain\.ext(.*) www$3.domain.ext/$2_$1$4

> domain.ext/something

www.domain.ext/something

> asub2.domain.ext/something

www.domain.ext/2_asubsomething

> asub.domain.ext/something

www.domain.ext/_asubsomething

I think.

> Your knowledge of regexp is the only limit in how much you can chop up your 
> hostname to rewrite the URL. 

Well, regardless of how I did, thank you. And now let's get the
nastiness over with, how did I do?

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


Mime
View raw message