Rewriting to absolute URLs

Topics: User Forum
Jun 10, 2009 at 4:39 PM

Firstly may I say that I'm new to this, but everything I've tried to make work so far has been fairly straightforward, so thanks!

I've been given a challenge recently and rather than waste valuable hours trying out different approaches, I thought I'd ask if it was possible first.

We have a website running, let's call it domain.com. This has had a new brand applied to it within a section of the site, which can be accessed from the root by domain.com/brandname.

The issue comes as they want to add a new domain name (branddomain.com) and just have it showing the domain.com/brandname, as the root.

I know that this will create issues in that the css and image files are in the root, so when the headers are picked up in IIS, the site won't see those files as they're effectively a level above the root level.

Is there a fairly simple way of running branddomain.com using a rewrite so that it appears as a root level domain but using files from a level above it?

Wow, I hope this is making sense...

The only way I've thought around this so far is to use absolute URLs for the css and image files, but would rather avoid this if possible.

I've got a feeling that it's going to delve in to RewriteCond, which is not something I've used before.

Any help would be greatly appreciated.

Thanks.

Jun 15, 2009 at 5:29 PM

I dont think you need rewriting for this, just set up the site in IIS and enable parent paths. This will allow the branddomain access to its parent folder with the css, and other necessary assets.

Jun 15, 2009 at 5:33 PM

Thanks for the response. I have, today, managed to sort out another way of doing it, which I'll share here...

RewriteCond %{HTTP_HOST} ^branddomain.com$
RewriteRule ^/?$ /brandPages/brandName.asp [U,I]

As there is currently only one to deal with, I though that this would be the best way. If I need to add more, I reckon I'll just add more RewriteCond rules.

Cheers.