Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 5.x > Installation and deployment > http://hostname redirecting to http://www.hostname View modes: 
User avatar
Member
Member
matt-v - 4/15/2013 1:36:23 PM
   
http://hostname redirecting to http://www.hostname
In our test enviroment, we have Kentico 5.5R2 on Windows 2008 R2, and IIS7.

The site is in /kenticocms subdirectory.

If I go to http://localhost/kenticocms locally on the machine the site is running on it works fine.

If I try to access the site remotely either by it's IP or hostname, I get http://www.hostname/kenticocms instead of http://hostname/kenticocms. I can get to the root directory on the web server and other sub directories just fine; but not Kentico.

I feel like I've looked everywhere in IIS and Kentico for what could possibily be doing this but can't find anything. Any ideas to point me in the right direciton would be appriciated.

User avatar
Member
Member
kentico_sandroj - 4/15/2013 5:19:44 PM
   
RE:http://hostname redirecting to http://www.hostname
Hi Matt,

I am almost certain that this is a setting within your IIS - could you please review the following two posts and check if their suggestions would work for you:

Solution One
Solution Two

Also, please check if you have canonical domains setup in your web.config file:
Canonical Domains

If you're still having trouble after reviewing these, please let me know.

Thanks,
Sandro

User avatar
Member
Member
matt-v - 4/16/2013 8:38:49 AM
   
RE:http://hostname redirecting to http://www.hostname
Well, it's not really a binding issue; the www prefix isn't working because there is no DNS setup for it.

http://localhost - works
http://localhost/kenticocms - works
http://hostname/ - works
http://hostname/kenticoms - redirects to http://www.hostname/kenticocms
http://192.168.1.10/ - works
http://192.168.1.10/kenticocms - redirects to http://www.192.168.1.10/kenticocms

URL Rewrite is not installed, and don't know why I would have to install it to fix this issue, but I will if I have to.

User avatar
Member
Member
kentico_sandroj - 4/16/2013 3:41:27 PM
   
RE:http://hostname redirecting to http://www.hostname
Hi Matt,

Is there any difference between:

http://hostname/kenticoms and http://localhost/kenticocms

Are they configured under different sites in IIS?

Also, please review the configuration as shown in the following screen shot and advise if yours is configured any differently.

User image

User avatar
Member
Member
matt-v - 4/17/2013 7:39:07 AM
   
RE:http://hostname redirecting to http://www.hostname
I did add the hostname as a domain alias, but did not add www. I've tried a couple of different things (hostname, www.hostname, /) in the redirect url, but it doesn't seem to make any difference.

I only have one site configured in IIS. There is no difference between hostname and localhost; everything else works but Kentico.

User avatar
Member
Member
kentico_sandroj - 4/25/2013 2:55:21 PM
   
RE:http://hostname redirecting to http://www.hostname
Would you mind uploading a screenshot of the Sites properties screen as the one I have uploaded? (General and Aliases)

Also, please provide your web.config file and a few screen shots of how you have configured IIS.

If your web.config file and site settings are not causing the redirect, it is happening outside of Kentico, or at least outside the default behavior of Kentico.

Thanks,
Sandro

User avatar
Member
Member
matt-v - 6/25/2013 2:27:04 PM
   
RE:http://hostname redirecting to http://www.hostname
Sorry for the long delay in reply... other projects got in the way.

I found the issue... it was code in global.asax.cs that was added by a third-party that customized our installation.

Thanks for your help.

User avatar
Member
Member
kentico_sandroj - 6/25/2013 4:07:15 PM
   
RE:http://hostname redirecting to http://www.hostname
Hi Matt,

No worries about the delay. Thank you for sharing the solution, it might help others that encounter the same issue.

Regards,
Sandro