Windows Server 2102 R2 - IIS 8.5 redirection assistance ?

Senior IT System Engineer
Senior IT System Engineer used Ask the Experts™
on
Hi,

How can I configure the IIS 8.5 in my Windows Server 2012 R2 to redirect:

www.domain.com/app to point to the www.domain.com (under the same webserver) ?

Because at the moment:
www.domain.com/app --> is showing IIS 404
www.domain.com --> works fine as my primary website.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dan McFaddenSystems Engineer

Commented:
Is there a directory path that exists to that destination?  Or are you asking that any http error 404s get redirected to your home page?

Dan

Author

Commented:
I just want it to be redirected to standardise and make user easier to download the mobile app.
Dan McFaddenSystems Engineer

Commented:
OK, but still need to know if the URL actually exists.  There are different ways to handle the situation.  If the path does not exist, you can capture the 404 and redirect.  If the path is real, you want to make sure you are only capture the path plus the default page, not any other pages in the path.

Dan
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Author

Commented:
Dan,

The 404 is the generic reply from IIS. There is no virtual directory with the /app in the Windows Server 2012 R2 web server.

If I open www.domain.com using my iPhone, it prompt me to download the Apple Store app which is what I want.

Author

Commented:
Dan, this is the error when I use my PC Browser to visit www.domain.com/app:

Server Error

404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Systems Engineer
Commented:
I understand that the 404 is the default 404 response from IIS.  What I do not understand is why you would want to build a redirect like this.

If the app installs fine from your home page, why do you need the /app redirect?  IMO, this is making the configuration of your site more complex than it needs to be.  Unless there is a legacy reason for the /app path...

I have to ask again... do you want only the 404 error for the path "/app" top be redirected to the home page or all 404s, since you mentioned standardizing something.

The simplest way to do this is:

1. Open IIS Manager, navigate to the site where you want to create the redirect
2. create a new Virtual Directory, name it "app" and point it to the root content directory.
3. select the Virtual Directory "app" and go into the HTTP Redirect feature
4. enable "Redirect requests to this destination:" and enter the full URL for your home page:  http://www.mydomain.com/
5. Apply the change

This will redirect traffic to the app location to the URL defined in the redirect.

Dan

Author

Commented:
Thanks Dan.
It works as expected.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial