Subdomains
Ok, So I've read quite a few threads on here, as well as a lot of help on other forums about the IIS rewrite, and I think I'm on the right track, but I still can't get it write.
So I have 1 site -> www.site.com
and I just want --> sub1.site.com & sub2.site.com to point too --> www.site.com/sub1 or www.site.com/sub2
not that is the easy part, the problem now is if you visit sub1.site.com the images, scirpts, css are all trying to load from:
www.site.com/sub1/images instead of www.site.com/images
can someone help please
This is my last attempt
<
rewrite
>
<
rules
>
<
clear
/>
<
rule
name
=
"Folders"
enabled
=
"true"
stopProcessing
=
"true"
>
<
match
url
=
".*/(.*)"
/>
<
conditions
logicalGrouping
=
"MatchAll"
trackAllCaptures
=
"false"
>
<
add
input
=
"HTTP_HOST"
pattern
=
"^(?!www)(\w+)\.bradken\.com|\.au$"
/>
</
conditions
>
<
action
type
=
"Rewrite"
url
=
"http://bradken.com/R:1"
/>
</
rule
>
<
rule
name
=
"SubDomain"
enabled
=
"true"
stopProcessing
=
"true"
>
<
match
url
=
"(.*)"
/>
<
conditions
logicalGrouping
=
"MatchAll"
trackAllCaptures
=
"false"
>
<
add
input
=
"HTTP_HOST"
pattern
=
"^(?!www)(\w+)\.bradken\.com|\.au$"
/>
</
conditions
>
<
action
type
=
"Rewrite"
url
=
"C:1/R:1"
/>
</
rule
>
</
rules
>
</
rewrite
>
Hi Byzza,
The thing is that your rule matches all requests, which is not what you want. Since all of your static files (CSS, JS, and embedded web resources) are not located on the path you are rewriting to. Your rules should exclude urls with .css, .js, .axd, extensions. As a matter of fact you should only rewrite the requests for pages (they are either extensionless or may have extension (.aspx, .html) if you are using additional urls or external pages).
Kind regards,
Radoslav Georgiev
the Telerik team