Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm a bit of a beginner when it comes to setting up ISS and rewriting rules, so I thought I'd ask for help here.

In an early stage of the project we decided to keep all urls and paths within our project absolute. Probably stupid, but we had heard that we would always be able to deploy our website to the root folder of the IIS, so this simply wouldn't be a problem in either test environments or in production.

Anyhow, the business now require that we deploy the website to a new test environment. En environment that is to be shared with other projects, so we have to make a subfolder in the IIS root. Making DNS changes is not an alternative, so our website can only be reached using the url:
[serverName]/[OurProjectName]/

And obviously, no links, images etc work in this new environment. It's going to be a huge effort rewriting all paths and urls in the project. So I was wondering, is there any way to solve this problem just changing the configurations in the IIS or in the webconfig? Maybe add some rewrite rule that inserts the application folder name to each request?

Many thanks!
Posted

1 solution

IIS has a URL rewrite module. It essentially allows you to define an inbound url rool and determine what the out bound url is.

[^]

I am still really confused as to the problem that you're facing. Why didn't you just make your url's relative that way it doesn't matter where your website is deployed too? At any rate I think a find and replace could make everything relative, which would make things a lot easier... wouldn't it?
 
Share this answer
 
Comments
suunker 20-Nov-14 23:14pm    
Thanks for the reply!

I think there are loads of reasons. As I mentioned before, we were supposed to be able to use the root directory of the web server. Another reason is that some url / paths would retrieved from Umbraco. Having an administrator with limited IT knowledge updating the CMS with url, it would simply be easier using absolute paths than relative paths. And believe me, if find and replace was possible we would do it but now we're talking maany hours of development to fix this.

I find those rewriting conditions hard to master. Could someone provide me with an example that is a bit closer to the problem that I'm facing? Much appreciated!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900