Redirect subdomain to subfolder of another subdomain - asp.net

What I want to do is take traffic that is going to shop.mywebsite.com and redirect or rewrite (I'm not sure of the terminology) the domain to be www.mywebsite.com/shop. Both shop.* and www.* are separate web applications (nopCommerce and Umbraco respectively) that don't seem to cooperate when I've tried to nest them. Both applications are in a Server 2008 R2/IIS 7.5 environment.
I've searched around stackoverflow and what I've found is a lot of answers to mapping the other direction (ie subfolder to a subdomain) but that's not what I'm looking for as far as I understand the problem.
The end goal is to combine the SEO reputation of the shop subdomain into the www subdomain. I readily admit that I might have this all backwards and am willing to try any suggestions I'm offered.
Thanks.

I think you are looking for URL rewriting.
URL rewriting is the process of
intercepting an incoming Web request
and redirecting the request to a
different resource. When performing
URL rewriting, typically the URL being
requested is checked and, based on its
value, the request is redirected to a
different URL
EDIT:
You may also want to check URL Rewrite Extension from microsoft, it will fix common SEO problems that your site might have.

Related

How to mask outbound URL in ASP.NET MVC?

I'm trying to redirect and mask all users from a page at my ASP.NET website to another website not using ASP.NET. ie, from www.site.com/site2 to www.site2.com. I want the url to be masked, so that users see www.site.com/site2 in their url rather than www.site2.com, and for subpages like site.com/site2/home to also work. My website is hosted on Microsoft Azure, and I would ideally like to redirect to a completely different page, but could also redirect to another Azure page.
However, I've been getting a bit confused with terminology. What methods can I use to go about this, and is there a specific search term I should be using? There are a lot of resources that discuss doing the opposite (masking part of your website as another site), but fewer masking an outward site as part of your site.
So far, I've found a couple of possible methods - Virtual Directories, and URL Rewrite.
For Virtual Directories, I found this useful blogpost: http://blogs.msdn.com/b/kaushal/archive/2014/04/19/microsoft-azure-web-sites-deploying-wordpress-to-a-virtual-directory-within-the-azure-web-site.aspx
But it doesn't quite work and I'm finding it difficult to find any more resources about Virtual Directories.
I also found URL Rewrite, which looks pretty cool: Mask URL to subdomain using IIS
However, they also mention that URL rewrite only works on the same website, which is not the case here.
Will either of these work to mask site2.com as site.com/site2?
I was not able to do exactly what I wanted to - simply redirect traffic from site.com/site2 to site2.com (and let users see site.com/site2 in the url). URL Rewrite does not do this, but it does do the opposite (map server content at site.com/site2 to user sees site2.com).
Virtual directories are close enough though. I'm actually storing the content at site.com/site2, so users see that as the URL. If I want users to alternately see site2.com if they go there, I can use URL Rewrite.
The first blog post I linked (http://blogs.msdn.com/b/kaushal/archive/2014/04/19/microsoft-azure-web-sites-deploying-wordpress-to-a-virtual-directory-within-the-azure-web-site.aspx) actually is spot on with how to set up Virtual Directories.
One of the problems for me following that post was the Site name and destination URL of the publish settings.
Basically the extension from Azure (outlined in red) matches the URL from publish settings, while the site\wwwroot\wordpress from Azure (green) matches the Site name from publish settings.

ASP.NET Url Rewrite Subdomain Wordpress II7 Web.Config

I have a server that host a variety of asp.net sites on a IIS7 server.
A few of those sites have wordpress blogs in a folder called blog (which is obviously written in PHP). Due to security issues, we need to move those wordpress blogs to a linux server.
So instead of http://www.domainname.com/blog we now have http://blog.domainname.com/ which has the blog url.
The only problem is, due to SEO reasons, we need the blog to be on the same domain as the main site (which is written in ASP.NET).
My question is, is there a way to do a url rewrite so that if someone types in a wordpress link, similar to this:
http://www.domainname.com/blog/index.php/archives/category/mycategory
Can I use a web config URL rewrite to have the above typed in URL actually point to
http://blog.domainname.com/index.php/archives/category/banking
I can't do any sort of redirect. It has to be a rewrite, I've tried righting one myself but have been unable to. The subdomain is the part of the rewrite I can't get past.
Has anyone tried to do this before?
Is there some better way I go about this if not.
Keep in mind the blog and the asp.net site cannot be on the same server due to security reasons, but they must keep the same domain name.
You can't just do a rewrite as the URL you want to rewrite to is on another domain / website. Rewrites only work on the same website.
You have to setup IIS as a reverse proxy server with the ARR module. In combination with the URL rewrite module you will be able to invisibly forward all requests for http://www.domainname.com/blog/* to http://blog.domainname.com/*.
Also note that you will have to setup outbound rewriting in order to change back the URL's that are generated by Wordpress (from http://blog.domainname.com/* back to http://www.domainname.com/blog/*).
See for an example this tutorial: Reverse Proxy with URL Rewrite v2 and Application Request Routing.

http https dupliacte content google

I recently installed an SSL cert on one of my sites. I have noticed that Google has now indexed both the http and https version of each page. I haven't really noticed any problem ranking wise so far, but I am conscious that a problem may occur with duplicate content.
How can I overcome this? Only a few of my pages will be using https, most of the pages on the site will be best served with just http, in fact I could get away with not using https pages at all for the time being if necessary.
A few ideas I have come across are: 301 redirects, redirect all https to http with .htaccess.
Robots.txt for the ssl pages , again using .htaccess. The problem here is that the https pages have already been indexed and I would like them to be deindexed. I am not sure if robots.txt would be sufficient because as far as I am aware robots.txt will just tell a bot not to crawl the page, but it has already been indexed.
Is there any other suggestions?
Use canonical URLs for this.
As i have already faced this problem ,Good solution will be cannonical link
Google will remove your indexd https page after some time (takes week to month ).For those page where you can't put cannonical link give 301 redirect from https to http .

Extract URL's from a website?

I would like to migrate a site, but the new URL's are completely different from the old URL's. I do not want to break my old sites links that are out there on the web. Is there a way to extract all the links from a site so I can generate a redirect table (I will probably put the redirects on the web server level)? The old is on ASP.NET with SQL server 2008 by the way. Am open to crawling the site or mining the SQL database, but need some help or advice.
You could use IIS Seo Optimalization Toolkit for that. http://www.iis.net/download/seotoolkit
With that tool you can spider the entire website. Then when the report finishes, go to Content -> Host summary and double click the host of the website. There you have a complete list of all spedered URL's.
And ofcourse, when you have these url's, you can make URL rewrite of routing mechanisms available to 301 to the right content on the new website.
The best way is to actually put a 301 redirect to notify all engines that your URL's have permanently moved Search for 301 in this http response code documentation for more info on 301. That is if I am understanding your problem (that you want links from other sites and searches and whatnot to realize that your site moved?).
It doesn't sound like you're running Apache. However, Apache has an available module called mod_rewrite. There may be a similar module for other web servers.
mod_rewrite allows you to do exactly what you are describing.
Perhaps with litle js magic if works for you

How to manage sub-domains on WinHost with IIS7 URL Rewrite 2.0?

I'm trying out WinHost and I'm running into some issues with sub-domains. On WinHost, you can have multiple sub-domains per hosting account, but each sub-domain points to the root website. E.g. you can have www.example.com, sub1.example.com, and sub2.example.com but all of them display the content at http://www.example.com/.
Other Hosts allow you to point sub-domains to a sub folder in your website. This would allow you to point sub1.example.com to /sub1, sub2.example.com to /sub2 and www.example.com to /.
WinHost recommends using an asp/aspx page to redirect http://sub1.example.com to http://sub1.example.com/sub1, which points to /sub1. While that would work, I'd like to not have the subdomain in the url twice.
So I tried using IIS7 URL Rewrite to point http://sub1.example.com to /sub1. Ben Powell describes this in detail on his blog. This is great, except Request.ApplicationPath is now /sub1/path/to/current/page.aspx, which breaks ASP.Net Themes (and probably other stuff too).
What can I do to fix the ApplicationPath? Is there a better way to accomplish this?
I tried my luck on serverfault. No helpful answers there either, but I did post my solution:
I couldn't figure out how to fix the
application path, so now I'm simply
using the URL Rewrite Module to
redirect (not rewrite) from
http://sub.example.com/abc to
http://sub.example.com/sub/abc. It's
not ideal, but it works. See my blog
post for the details.
https://serverfault.com/questions/134125/how-to-manage-sub-domains-on-winhost-with-iis7-url-rewrite-2-0/135533#135533
Altaf's article explained the resolution by removing the ~ sign. Look at the point 7 there.
Winhost.com – How to REALLY run multiple sites under one account
see below url
https://benpowell.org/winhost-com-how-to-really-run-multiple-sites-under-one-account/?unapproved=31073&moderation-hash=8d58e661f6d4dafcd93335a0a837b193#comment-31073

Resources