views:

234

answers:

2

I'm trying to use ManagedFusion UrlRewriter module on my main/root web site to redirect requests with a certain host name to a sub-folder of the root. Let's say my root is called profkroot.com, and it has a sub-folder (ASP.NET application) called cottages. I also have a domain called profkcottages.com, which I'm trying to redirect to profkroot.com/cottages.

Using the following example rule, I get a totally borked rewritten URL. I grok the regex side of the rule, but I don't know enough about the rewrite part, and this is getting kind of urgent, so any help will be appreciated.

Here is the rule in place on profkroot.com: RewriteEngine On

#Fix missing trailing slash char on folders
RewriteCond %{HTTP:Host} (.*)
RewriteRule ([^.?]+[^.?/]) http\://%1$1/ [R]

#Emulate profkcottages.com
RewriteCond %{HTTP:Host} (?:www\.)?profkcottages\.com
RewriteRule (.*) /cottages$1 [NC,L]

Here is the rewritten url if I request http://profcottages/home.aspx:

http://profkcottages.com/http/://profkcottages.com/home/.http/://profkcottages.comaspx/
A: 

Turns out I had the RewriterModule added twice; once under System.Web, for IIS6 (hosted) and once under System.WebServer, for IIS7 (local). Still not working 100% with css and img content, but that's another question.

ProfK
+1  A: 

The CSS and image content is an easy one, the rules you have are not handling them correctly.

Nick Berardi
OK, any hints on why the rules are not handling them correctly?
ProfK
A couple reasons, you could be using relative URL's for your images and CSS, which is the most likely cause. The second is that your images content exist in the cottages directory the same way they are being requested. Try enable logging RewriteLog "log.txt"RewriteLogLevel 9and see what the URL's are coming through as for images.
Nick Berardi