Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect a URL path in IIS?

In IIS 6.0, is there an easy way to re-direct requests to a folder to another folder, while preserving the rest of the path.

e.g.

If I have moved the content from:
mysite.org.uk/stuff
to
stuff.mysite.org.uk/

Can I automatically redirect requests for specific pages like
mysite.org.uk/stuff/countrybriefing/tanzania/travel.html
to
stuff.mysite.org.uk/countrybriefing/tanzania/travel.html

I know that .htaccess can do things like this in Apache, is there an equivalent in IIS?

like image 473
codeulike Avatar asked May 20 '09 14:05

codeulike


People also ask

How do I setup a redirect in IIS?

In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services. On the Select Role Services page of the Add Role Services Wizard, expand Common Http Features, select HTTP Redirection, and then click Next. On the Confirm Installation Selections page, click Install.


1 Answers

Format the redirect URL in the following way:

stuff.mysite.org.uk$S$Q

The $S will say that any path must be applied to the new URL. $Q says that any parameter variables must be passed to the new URL.

In IIS 7.0, you must enable the option Redirect to exact destination. I believe there must be an option like this in IIS 6.0 too.

like image 193
Nirmal Avatar answered Sep 17 '22 02:09

Nirmal