| Author |
|
Prox Newbie

Joined: 27 February 2010
Online Status: Offline Posts: 2
|
| Posted: 27 February 2010 at 6:25am | IP Logged
|
|
|
Hi
I am trying to set up some rewrite rules. They work for my main domain, but i want them to work for my subdomain as well. I am not good at this and can not figure it out. I hope someone can help me out? This is basically what i have:
[ISAPI_Rewrite]
## sub domain rewrite (eg: customer1.mysite.nl) ## this works fine for the root level RewriteCond Host: (?!www\.)([^.]+)\.mysite\.nl RewriteRule (.*) /$1$2 [I,L]
## This part works for my normal domain: www.mysite.nl ## Not for: customer1.mysite.nl/subpage ## So, www.mysite.nl/about works fine ## But customer1.mysite.nl/info does not do anything 
RewriteRule ^$ /index.php [I,L] RewriteRule ^/([a-zA-Z0-9\-_]+)$ /index.php?path=$1
Can anybody point me in the right direction or give me a sollution? I would be very happy. Thanks.
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 01 March 2010 at 3:25am | IP Logged
|
|
|
Do you have this config in the root of your site or is it global?
If it's under the site, please make sure you have correctly set the headers mappings for the site.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
Digiover Newbie

Joined: 14 October 2005 Location: Netherlands
Online Status: Offline Posts: 18
|
| Posted: 03 March 2010 at 8:48am | IP Logged
|
|
|
This concerns one of our customers, with a very specific question we couldn't solve in our limited available time.
It's a config in the web root of the IIS web site.
Host headers in IIS are set up correctly.
The situation is: mysite.nl is a web site with host headers in IIS, host headers such as www and ftp (www.mysite.nl, ftp.mysite.nl). The host header customer1 (.mysite.nl) also exists and needs to be pointed to /customer1. Files in /customer1 are equal (duplicate) to the files in /.
My guess was something like:
RewriteCond Host: (?!www\.)([^.]+)\.mysite\.nl
RewriteRule (.*) /$1$2 [I]
RewriteRule ^/([a-z0-9\-_]+)$ /$1/index.php?path=$3 [I]
(for "customer1.mysite.nl/index.php?path=klanten" for example). The sub domain host header (www, customer1, etc) would be preserved in $1. Correct?
Or perhaps we need to play with the "[NO]" or "[N]" switches?
__________________ Met vriendelijke groet / Best regards,
Jan Reilink, VEVIDA Nederland BV
Postbus 329, 9700 AH GRONINGEN, +31(0)50 - 5492234
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 03 March 2010 at 10:01am | IP Logged
|
|
|
I'm not sure I understand how you want these two rules to work. Do you want them to fire one after another? Or are they destined for catching
different URL patterns? Please give a specific example of the request you need to handle and what the resulting URL should be.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
Prox Newbie

Joined: 27 February 2010
Online Status: Offline Posts: 2
|
| Posted: 03 March 2010 at 10:21am | IP Logged
|
|
|
@Jan: thanks for explaining and your help so far. I appreciate that!
@Anton: I hope i do understand your question and that this will help in explaining:
1) www.mysite.nl/about result: www.mysite.nl/index.php?path=about
2) customer1.mysite.nl/info result: customer1.mysite.nl/index.php?path=info
|
| Back to Top |
|
| |
Digiover Newbie

Joined: 14 October 2005 Location: Netherlands
Online Status: Offline Posts: 18
|
| Posted: 03 March 2010 at 10:38am | IP Logged
|
|
|
For as far as I understand, one request could be:
www.mysite.nl/klanten, resulting URL: www.mysite.nl/index.php?path=klanten
www.mysite.nl/orders, resulting URL: www.mysite.nl/index.php?path=orders
customer1.mysite.nl/klanten, resulting URL: customer1.mysite.nl/customer1/index.php?path=klanten
customer1.mysite.nl/orders, resulting URL: customer1.mysite.nl/customer1/index.php?path=orders
An extended request/URL then is:
customer1.mysite.nl/customer1/orders/payment, resulting URL: customer1.mysite.nl/customer1/index.php?path=orders&id=payment
www.mysite.nl/orders/payment, resulting URL: customer1.mysite.nl/customer1/index.php?path=orders&id=payment
(www.mysite.nl is the website root, customer1.mysite.nl goes to root/customer1 folder with a RewriteRule)
My bet was that the 'Host: ([^.]+)' could be saved in $1, it would be preserved and use usable in further rules (until the [L]-switch is used)
Or perhaps an extra 'RewriteCond Host: ([^.]+)\.mysite\.nl ' is necessary(?), like:
----
RewriteCond Host: (?!www\.)([^.]+)\.mysite\.nl
RewriteRule (.*) /$1$2 [I,L]
RewriteCond Host: ([^.]+)\.mysite\.nl
RewriteRule (.*) /$1$2 [I,NS]
RewriteRule /([a-z0-9\-_]+)$ /$1/index.php?path=$3 [I]
...
...
----
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 04 March 2010 at 4:19am | IP Logged
|
|
|
"My bet was that the 'Host: ([^.]+)' could be saved in $1, it would be preserved and use usable in further rules (until the [L]-switch is
used)" - your guess is wrong. The Host value may be used only in ONE subsequent RewriteRule statement.
So, I guess your config should look like this:
#www.mysite.nl/klanten, resulting URL: www.mysite.nl/index.php?path=klanten
RewriteCond Host: www\.mysite\.nl
RewriteRule ([^./]+) /index.php\?path=$1 [I,L]
#customer1.mysite.nl/klanten, resulting URL: customer1.mysite.nl/customer1/index.php?path=klanten
RewriteCond Host: (?!www\.)([^.]+)\.mysite\.nl
RewriteRule ([^./]+) /$1/index.php?path=$2 [I,L]
#customer1.mysite.nl/customer1/orders/payment, resulting URL: customer1.mysite.nl/customer1/index.php?path=orders&id=payment
RewriteCond Host: (?!www\.)([^.]+)\.mysite\.nl
RewriteRule /([^./]+)/([^./]+)/([^./]+)$ /$1/index.php?path=$3&id=$4 [I,L]
#www.mysite.nl/orders/payment, resulting URL: customer1.mysite.nl/customer1/index.php?path=orders&id=payment
RewriteCond Host: www\.mysite\.nl
RewriteRule /([^./]+)/([^./]+)$ http\://customer1.mysite.nl/customer1/index.php?path=$3&id=$4 [I,L]
Please report which of the cases worked/didn't work for you.
__________________ Regards,
Anton
|
| Back to Top |
|
| |