|
Home > Archive > Apache Server configuration support > January 2005 > Urgent Rewrite Question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Urgent Rewrite Question
|
|
|
| Hi,
I'm trying this type of configuration without success:
what I need is:
a-b-c.mydomain.com:8080/directory/page-name.htm
need to be rewrite in
www.mydomain.com:8080/directory/xyz...aram2=page-name
I'm trying to do this using configuration I read around but I find I'm not
able ... sigh!!
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
RewriteCond %{HTTP_HOST} !^mydomain\.com [NC]
RewriteRule
^http://([a-z0-9A-Z,\-]+)\.mydomain\.com:8080/directory/(.*).htm$
/directory/test.php?sd=$1&p=$2 [L]
Can you help me?
Thanks,
a.
| |
|
| "Ivan" <nospam@nospam.com> schreef in bericht news:41fa24bc@x-privat.org...
> a-b-c.mydomain.com:8080/directory/page-name.htm
> need to be rewrite in
> www.mydomain.com:8080/directory/xyz...aram2=page-name
> I'm trying to do this using configuration I read around but I find I'm not
> able ... sigh!!
>
> RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
> RewriteCond %{HTTP_HOST} !^mydomain\.com [NC]
> RewriteRule
> ^http://([a-z0-9A-Z,\-]+)\.mydomain\.com:8080/directory/(.*).htm$
> /directory/test.php?sd=$1&p=$2 [L]
Protocol, server, domain and port are NOT part of the URL here ...
Based on an example found at
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
I'ld try -aka code comes untested-:
RewriteEngine on
# prepare to convert to lower case
RewriteMap lc int:tolower
# skip plain www in domain
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
# check for and isolate servername
RewriteCond %{HTTP_HOST} ^([^\.]).mydomain\.com [NC]
# use servername and partial path as parameters
RewriteRule ^directory/(.*).htm$ /directory/test.php?sd=${lc:%1}&p=$2 [L]
Enjoy (testing),
HansH
|
|
|
|
|