IIS Server Subdomain Redirection - iis

I have a Windows Server 2012, with IIS 8 installed. I have multiple websites there. I also have the Default Website.
When I create a new website like www.abc.com and abc.com, it works fine. However, when a customer enters an invalid subdomain to abc.com (a subdomain definition that is not actually there), like xyz.abc.com, it automatically redirects to my Default Website which is a landing page.
Instead, I want to return a custom 404 page from IIS. Is that possible?
Thanks.

Your DNS should be taking care of that. If xyz.abc.com doesn't exist in the zone, no browser should be coming even close to IIS.
That is, unless you have a wildcard record configured. It sounds like you might.
Give it a look.

Related

Connect WIX to subfolder of domain

I have a website example.com that is hosted on AWS. The main site is being produced by a development team. I have a landing page created through WIX.com. I would like to point the landing page to something like "example.com/promo" without interfering with the rest of example.com. Is this possible?
Yes, it is possible, you just need to use URL Rewrite on your code, so when people browse to example.com, it will automatically redirect to example.com/promo.

How to redirect example.mydomain.com to folder.mydomain.com via DNS/.htaccess?

Is it somehow possible to redirect example.mydomain.com, a subdomain which does not actually exist, to folder.mydomain.com using either .htaccess or DNS? How can this be achieved?
When I access DNS from the control panel and click on the Web DNS tab, I see Personal web DNS settings, under which I believe I can submit domains and their values. However, I am confused with the type (web alias, web forward, A, CNAME, TXT, SRV, AAAA...). Could someone help me?
If the .htaccess way is simpler, I would then prefer it.
Thank you.
You wouldn't be able to use .htaccess as the subdomain does not exist.
I assume, from the process you described, that you are using One.com hosting. If so, the following guide will be of help:
Manage your DNS settings
Essentially, a web forward DNS entry will work for you:
Click on the Web DNS tab.
In the hostname/domain column, enter the subdomain you would like to redirect.
Set the type to web forward
Set the value to where you would like to be redirected when visiting the subdomain.
Click the (+) sign to save your changes.
It will take up to 90 minutes for your changes to take effect.

Using URL Rewrites to allow 1 IP address to host two subdomains

I have a scenario where I need to two different subdomains to come through the firewall and be rewritten or redirected to areas on the server. For example if I have sub1.mydomain.com/testsub1.html entered externally, I want it to hit the IIS "Default web site/folders/sub1/testsub1.html" and likewise, if sub2.mydomain.com/testsub2.html is received I want it to go to "Default web site/folders/sub2/testsub2.html". We were told that URL Rewritew would be the way to go on this. So we set up rules in the Default web site, to use the MatchURL pattern for:
1. sub1.mydomain.com(.) and to rewrite it to "Default web site/folders/sub1(R:1)" with the action type of Rewrite.
2. sub2.mydomain.com(.) and to rewrite it to "Default web site/folders/sub2(R:1)" with the action type of Rewrite.
If I hit http://sub1.mydomain.com/testsub1.html, I get a file not found error. What I am seeing in the logs is the GET /testsub1.html. If I change the URL to http://sub1.mydomain.com/folders/sub1/testsub1.html, it works perfectly and I see GET /folders/sub1/testsub1.html in the logs and the proper page is displayed in the browser.
What am I missing to make this work without the full path?
Bindings are the best way to handle this. They can listen on the same IP address for different hostnames. Create two separate websites in IIS and configure each of their bindings for that particular subdomain.
More information: http://blogs.technet.com/b/chrad/archive/2010/01/24/understanding-iis-bindings-websites-virtual-directories-and-lastly-application-pools.aspx

Redirect loop problem in IIS on shared hosting

I have a problem where when I go to my website it comes up with a redirect loop. I've tried clearing the URL Redirects from the IIS Admin Console in the web control panel from my hosting provider and I've also tried removing the httpd.ini file from the site root directory to try and clear all re-directs, but for some reason when I go to the site it STILL wants to redirect in an endless loop. The site is agrionline.biz
Before i did anything I had a subdirectory domain pointing set up which made http://agrionline.biz actually use agrionline.biz/site1/ as the root folder.
I wanted to change this so that instead of that I wanted my site to actually redirect to the site1 folder, rather than use it as the root. So I went into the IIS Admin Console on my hosting providers web control panel and tried to add a URL Redirect from '/' to '/site1/'. Then i went to the domain pointing admin page in the hosting providers web control panel and deleted the domain pointing. Anyway after doing all this, the site is now stuffed and if I go to back to both these areas and clear the redirects and the domain pointing and even go and remove the httpd.ini file that was created, the site still incorrectly re-directs!
What can I do to resolve this? Any ideas? Has anyone experienced this before on a shared hosting account without direct access to IIS.
From the control panel it says my server platform is Windows 2008 Server Enterprise.

Sharing single application across a 2 subdomains in IIS7

I have an application that is currently deployed (ex. www.example.com ). However, now we have a "secure" subdomain, which will take all of the requests that need to be encrypted (ex. secure.example.com). The site that is at www.example.com is currently mapped to C:\inetpub\example.com\wwwroot\, and I've mapped secure.example.com to C:\inetpub\example.com\wwwroot\secure.
However, since secure.example.com was setup as a new website within the IIS Manager, when the secure site is visited, it displays an error since there is no web.config associated with this website; however, this is the way I want it since I want this to be a part of the application that is in the parent directory.
I think what you really meant to do was just right click on the web site for example.com and edit the bindings. In there you can add host names to that site.
Make sure you add them for port 443 which is SSL.
Map both the IIS virtual directories/web sites to the same directory, and check that are both using the same IIS application name.
(Not tried this, but can't recall seeing anything to say it would not work.)

Resources