IIS Virtual Directory Map to different URL - iis-7.5

So on a normal machine (i.e. not a server) running Win 8.1 I have this virtual directory on the DefaultWebSite, to get to it I type in Google http://localhost/MyCoolSite.
Now, I want to map that to http://mycoolsite.com or something similar - just not have it accessed via http://localhost/MyCoolSite.

You need to make IIS rewrite rule for mapping / to /MyCoolSite URLs. The second item you need to take care of resolving the mycoolsite.com hostname. For this you need to simply update the C:\Windows\System32\drivers\etc\host with your local IP with hostname. Like,
127.0.0.1 mycoolsite.com

Related

How do I map IIS virtual directory to a subdomain?

Currently, I have a website mapping as following
http://subdomain.domain.com/<virtualdir> to http://<IP Address>/<virtualdir>
I want the virtual directory to be accessed with just the subdomain:
http://subdomain.domain.com/
so that it points to http://<IP Address>/<virtualdir>
Im using IIS 10, windows server 2016.
What are my possible options?
If I understand your question correctly you want http://subdomain.domain.com/ to be accessible by the plain URL http://subdomain.domain.com.
If that is the case you want to go into your IIS:
1. select
2. right click
3. convert to application
You can then give it bindings just like your base website with your desired DNS entry.
Side note; You can then either remove your binding from the base site that you want on the or give it the same address of http://subdomain.domain.com but some other port so it would be http://subdomain.domain.com:8080 to access the and http://subdomain.domain.com for the original content at the base site

Redirect TLD (dev) to local IIS

In the office, we have already setup a redirect in the DNS to push .dev back to the localhost. The issue is when I am not in the office this does not work. I edited my host file for the websites but as I add more in the future I would prefer to not have to edit my host file.
Is there a way, within my computer, that I can force the TLD of .dev to always go back to my localhost?
I realize I may have to find a way to do this on my router so that the DNS is resolved.
Example:
- Local IIS
-- Website A (with a Host Name Binding of website-a.dev)
-- Website B (with a Host Name Binding of website-b.dev)
When I open a browser on my local box and type in website-a.dev, it should loop back to my local IIS and pull this website. Same thing for website-b.dev, of course, going to the other website. Now I know if at work we have setup the DNS to allow for this but I want to know if this can be done at home, where I do not have direct access to the DNS.
I know I can just put into my host file
127.0.0.1 website-a.dev
But I want a catch all for .Dev to go back to 127.0.0.1
Take a look at:
https://superuser.com/questions/135595/using-wildcards-in-names-in-windows-hosts-file
It explains that using Acrylic allows you to use wildcards and acts just like your host file.

Why is IIS going to the wwwroot folder instead of the one I want it to?

For the default Web Site in IIS I have the following binding on the default website:
I have the following binding on the site I want to access:
When I access the site in the browser with localhost/hostname, I'm pointed to C:\inetpub\wwwroot*hostname*. I have another site set up with a hostname binding that uses the same values for Port and IP Address and it points to the right place (a different folder on my C: drive). I'm running my site locally and I have the correct hostname entry in my hosts file. I don't want to create two separate virtual directories under a single website, I want the sites to be available as separate websites. What am I missing?
When you use the hostname feature in iis, you cant use localhost to access the site any more.
Instead use http://myhostname and setup myhostname to point to 127.0.0.1 in your hosts file.
If you want to access the site via localhost, that implies you need to make a virtual directory, or "application" in iis.

How to host multiple iis websites cleanly mapped to different ports?

I'm having trouble finding info on this one, even having access to my company domain controller I still can't see what configuration is causing the same behavior I want to mimic on my home server.
I'm working from a test environment on my home PC and would like the following behavior. Note that I do not require any of these sites be accessible anywhere but my local machine, again, I just want to learn.
My Goal:
To configure IIS to host multiple sites, accessible via "aliases" which map to different ports. For example:
home -> localhost:81
test -> localhost:82
dev -> localhost:83
Furthermore, I want the url in my address bar to actually BE what it says on the left, not simply redirect, BLEH! So if I type "home/" in my address bar, it should load the page at "http://home/".
How can I achieve this? Thanks... ;)
Here's what I have configured in my bindings for the site so far, but no cigar...
first you need to edit your hosts file (probably C:\WINDOWS\System32\drivers\etc) so that you resolve home for example to localhost, add records like this:
127.0.0.1 home
127.0.0.1 test
...
Then you should be able to set up your IIS site with the Host name as home, but leave the port to the default of 80.
When I create a site in IIS I select for IP "All Unassigned" and then make a unique port.
I access my sites via the outside world like this:
http://mbdev.myftp.biz:8004
http://mbdev.myftp.biz:8006
Those all go to demos sites.

How to display content from another domain by editing CNAME records?

I have a site that lets people have their own e-stores, for ex- mysite.com/clientname
What I want is, if somebody opens store.clientname.com or clientname.com/store, the content is pulled from mysite.com/clientname. [ So that their users feel that they are browsing on their site ]
I know this is possible because site'e like tumblr let you do that by changing a CNAME entry for your domain to their IP address.
I do have a dedicated IP address.
Also, can this be done by editing the .htaccess file at clientname.com, and if yes, which method is better/easy?
You'll want to solve the problem in a completely different way for http://store.clientname.com/ versus http://clientname.com/store.
In the first case, you can serve the web site as a virtual host. Just set up a virtual host called store.clientname.com and set its DocumentRoot to be the existing directory that contains the files for http://mysite.com/clientname. If you have other web server configuration directives that apply to http://mysite.com/clientname then you'll also want to apply those in the virtual host. Finally, the client can set up a CNAME record in DNS for store.clientname.com pointing to your web server.
If you are using Apache, you can also use a default virtual host and mod_rewrite to dynamically translate URLs of the form http://store.{whatever}/ to http://mysite.com/{whatever}/. However, this won't work if you are using HTTPS.
In the second case, you don't want to serve the web site at http://clientname.com/ because the client presumably is already hosting that and presumably http://clientname.com/otherstuff has to continue working and come from their server. So the second case is easier for you because all the work has to be done on the client's web server. But it's simple: they will just have to configure their web server to proxy http://clientname.com/store to http://mysite.com/clientname.

Resources