Where should a canonical domain name be enforced? - iis

Our client would like to use just one domain name for their site to prevent diluting page rank in search engines.
For example, stackoverflow.com is the domain name they always use. If you type in www.stackoverflow.com you get redirected to the non-www version, as this is their choice for their domain name.
Where should this be done?
At the application server level (ex in IIS, set up a site and have it issue a permanent redirect to the proper domain name
At the application level
I don't like #1 as it means I have a bunch of extra sites set up just for redirecting. I don't like #2 as rewrite rules do affect performance.
thanks.

Do it at as low a level as you can possibly do it. Your application shouldn't know about its root domain name.

Related

What is the correct way to name a subdomain?

It is about naming URLs, for example www.example.com/pagename and www.pagename.example.com.
Are they under the same domain name? if so, I don't understand why some websites choose the second option (www.pagename.example.com) for some of their pages instead of keep going with the 'normal' way (www.example.com/pagename).
Are there any advantage or disadvantages of adding the name at the beginning of the URL?
Simply speaking, www.pagename.example.com has subdomains www, pagename and example. There does not appear to be an index/home page specified.
www.example.com/pagename has subdomains www, exmaple. It has a page name in this case specified as it is / forward slash after top level domain.
In answering your question, well that depends on your needs. If you have separate sites or areas of interest "domains" then you can divy it up but still be under one domain mysite.

URL Canonocalization with w2 instead of www?

Recently while scrolling around the internet I've found a few websites that have w2 at the beginning of the URL instead of www. I'm not really sure of what the purpose of using this form of canonicalization may serve, other than just to be different. But after seeing that the Vatican's website also has it now, I'm starting to think it may actually have a functional purpose.
The Vatican's website has a lot of interesting redirects, but for me at least they all end up going back to w2.vatican.va as the base URL.
www.vatican.va redirects back there, google redirects there although it was indexed with the www.
So what is the purpose of using w2 instead of www?
The w2 is a subdomain, just as www is actually a subdomain. vatican.va is the top-level domain.
There are many uses for subdomains that usually come at the discretion of the developers, engineers, or administrators of a web site.
This is why sometimes you will see websites without the www (e.g. https://example.com). They have chosen to exclude the www subdomain. Most will pick one version to be their canonical and redirect the other to it.
In the example you provided, they chose to make their primary subdomain w2.vatican.va at some point and are redirecting (likely older) links from the www.vatican.va to the new one.
Additionally, the w2 domain may indicate that the web server is using IBM's CICS Transaction Server. The w2 may be it's default listener and the server administrators did not choose to change it.

Same website on same domain name with different extensions - i.e. .com and .co.uk

What is best practice for doing this? Should I have duplicate content at each domain or should I redirect from one to the the other, i.e. all traffic to the .co.uk domain redirected to the .com domain?
Best practice is to send them all to one web server.
By default the server will not care which domain is pointed at it and will show the home page as domainx.com if you to it from domainx.com.
However there are two possible issues with this that come to mind:
The person who created the website hopefully only used relative links. (The contact us button points to contactus.htm instead of http://domainx.com/contactus.htm ) If not, some links might change the user from domainx.co.uk to domainx.com.
Search Engine Optimisation: Its better SEO wise if all the links to your site point to one domain name rather than appearing as several less popular sites.
You can get everyone on the same site by using a RewriteRule or 301 Redirect to the primary site. Or you can make every hyperlink on the site absolute and point to the primary domain.

Use htaccess mod_rewrite to hide domain name

I've read lots about what can be done with mod_rewrite but I haven't found one to solve my problem. Maybe it can't be done?
I have a sub-domain on my primary domain that I have a customer direct user to to use one of my programs. The customer doesn't want his customers to see that that are on my domain and he doesn't want to use an iframe.
So, is it possible for the user to only see www.subdomain/program.php instead of www.subdomain.mydomain.com/program.php?
If you want the browser to show www.subdomain/program.php in its location bar, you need to register the www.subdomain domain name. There is no way to remove bits of the domain name using anything in the htaccess file. For example, if you've registered example.com and you have a server at foo.example.com, and you want to be able to go to http://foo/some/path/index.html, you're out of luck because the browser is going to attempt to do a DNS lookup of foo and it will most likely fail unless there happens to be a "foo" server under the DNS search domain. Browsers put a great deal of effort to prevent spoofing of the domain name, since it would be really bad if I was able to spoof my website to show the domain of a bank in a browser's location bar while actually visiting an entirely different website.

Transferring Everything from One Domain to Another

I want to move from one domain to another one that is shorter and (hopefully) easier to remember, but I also want the transition to be as seamless as possible.
I'm a coder so I know about 301 redirects and I intend to use them, but is there something easier than manually adding entries in my .htaccess file?
The website is static with the exception of the blog, which is under the /blog/ directory and powered by WordPress. I want it redirected to my new domain name. File and folder structures don't change. Isn't there some kind of wildcard thing for this?
What type of web server is the site being hosted on? If its on Apache, you can use the RedirectMatch command
Why not leave the web site unchanged, and [temporailly] let the both the old and the new domains assume the IP of the site, at the level of DNS ?
In other words.
Let the DNS setup for the existing domain as-is (for now)
have the DNS of the new domain assingn the particular server name to the IP of the web server (or preferablly to a 2nd IP, also assigned to this very site).
In a few months / whenever the old domain is soon to expire, check what residual traffic may still be using the old domain name (Old IP), and for them only, add a small piece of text somewhere in the UI to inform them of the new domain.

Resources