Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anything special about "it" in RegExes

Status
Not open for further replies.

andre0876

IS-IT--Management
Apr 30, 2001
2
DE
Hi everyone!

I have a little problem with a set of regular expressions that are to
be used in my httpd.conf file for mod_rewrite (Apache 1.3).

My configuration includes the following lines:

RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www\.domain\.de/[^(de/)].*
RewriteRule ^/(.*)$ /de/$1

RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www\.domain\.it/[^(it/)].*
RewriteRule ^/(.*)$ /it/$1

RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www\.domain\.pl/[^(pl/)].*
RewriteRule ^/(.*)$ /pl/$1

What I want to achieve is that files requested via will
be served from documentRoot/de, those requested via from
documentRoot/pl and so on.

This works for .de and .pl however it does not for .it. Is there
anything I overlooked concerning special behaviors of certain
characters?
The log file says

RewriteCond: input='pattern='^www\.domain\.pl/[^(pl/)].*' => matched
10.112.151.237 - - (2) rewrite /index.html -> /pl/index.html

RewriteCond: input='pattern='^www\.domain\.it/[^(it/)].*' => not-matched

I don't really get it.

Could I do this with a more general approach like

RewriteCond %{HTTP_HOST}%{REQUEST_URI}
^www\.domain\.([a-z]{1,3})/[^\1].*
RewriteRule ^/(.*)$ /$1/$2

??

Would be nice if the second thing worked so I did not have to edit the
config file when a new top level domain is introduced. But the first
approach would be totally sufficient, as long as I get this to work
with ".it".

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top