how to park domain on subfolder

Topics: Developer Forum, User Forum
Dec 24, 2009 at 6:43 AM

Hi all.

I have to rewrite rules for website have urls like.

http://www.domain.com

http://www.domain1.com 

http://www.domain2.com  and so on

In the IIS the all the domains  are maped to same IP address. i.e http://www.domain.com and http://www.domain1.com and http://www.domain2.com is the same thing. i.e each  will  browse the index page on root folder.

Now using the URL rewriting i want to map the first domain i.e www.domain.com to root folder while the the other domains to different folders.

e.g http://www.domain.com browse the index page on the root folder.

while http://www.domain1.com browse the index page on the root/domain1 folder and

while http://www.domain2.com browse the index page on the root/domain2 folder

while http://www.domain3.com browse the index page on the root/domain3 folder

while http://www.domain4.com browse the index page on the root/domain4 folder

and so on.

Now I want to rewrite a cond directive and rule directive that check if the url is http://www.domain.com then don't rewrite the url otherwise rewrite the url some like this

rewrite condition (if there is  domain other  than domain.com) then

rewrite rule   map to                         http://www.domain.com/domain/

Thanks to All.

Coordinator
Dec 24, 2009 at 2:15 PM

See the documentation.

There's a page that covers this.

 

Dec 30, 2009 at 5:24 AM

Thanks for reply.

Regarding my problem the solution provided in the page u mension does not apply. Please once again look into my problem.

 

I have to rewrite rules for website have urls like.

http://www.domain.com

http://www.domain1.com 

http://www.domain2.com  and so on

In the IIS the all the domains  are maped to same IP address. i.e http://www.domain.com and http://www.domain1.com and http://www.domain2.com is the same thing. i.e each  will  browse the index page on root folder.

Now using the URL rewriting i want to map the first domain i.e www.domain.com to root folder while the the other domains to different folders.

e.g http://www.domain.com browse the index page on the root folder.

while http://www.domain1.com browse the index page on the root/domain1 folder and

while http://www.domain2.com browse the index page on the root/domain2 folder

while http://www.domain3.com browse the index page on the root/domain3 folder

while http://www.domain4.com browse the index page on the root/domain4 folder

and so on.

Now I want to rewrite a cond directive and rule directive that check if the url is http://www.domain.com then don't rewrite the url otherwise rewrite the url some like this

rewrite condition (if there is  domain other  than domain.com e.g http://www.domain1.com) then

rewrite rule   map to                         http://www.domain.com/domain1/

Also the rule must work if someone write http://domain.com, http://domain1.com http://domain2.com

In simple http://www.domain.com should open wwwroot\domain\index.aspx

http://www.domain1.com should open wwwroot\domain\domain1\index.aspx

http://www.domain2.com should open wwwroot\domain\domain2\index.aspx

http://www.domain3.com should open wwwroot\domain\domain3\index.aspx

Thanks to All.

Coordinator
Dec 31, 2009 at 9:44 AM

Please once again look into my answer.  The page I referenced covers this.  EXACTLY what you are asking about.

There are lots of examples.  What have you tried?

Dec 31, 2009 at 10:43 AM

Thanks for your reply.

RewriteLogLevel 3
MaxMatchCount 10
RewriteEngine On
IterationLimit 10
StatusUrl /iirfStatus

CondSubstringBackrefFlag *


# Checks for local file existence so that .css, .js and other  static
# files aren't rewritten

RewriteCond %{HTTP_HOST}   ^(www\.?)([^\.]+)\.(com|co\.uk)$
RewriteRule ^/(.*)$        /*2/$1   [L]

 

RewriteCond %{HTTP_HOST}   ^([^\.]+)\.(com|co\.uk)$
RewriteRule ^/(.*)$        /*1/$1   [L]

This solved my problem. Now I don't want to rewrite css or js files how should i do this. thanks

 

Coordinator
Jan 1, 2010 at 3:54 AM

Check the documentation.  There's a special replacement pattern - a dash - that you use to exclude URLs from being rewritten.

RewriteRule ^/PATTERNHERE   -  [L]

If you specify a pattern that matches .css or .js, then that rule will fire, and .css and .js URLs won't be rewritten.