ASP.Net - Url Forwarding with Rewriting - asp.net

I am developing a web site that uses a CMS and my actual home page is at mydomain.com/cms/home.aspx
When a user visits mydomain.com/index.aspx how to do I forward the site visitors to mydomain.com/cms/home.aspx?
One way is to create a dummy index.aspx with redirect to mydomain.com/cms/home.aspx but just wondering if there is a better way to do... may be in web.config or somewhere else!
Thanks
Sid

Redirects: How to redirect a URL path in IIS?
Rewrites: http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/
Both are a bit of learning, but can be achieved in a reasonable amount of time.
You always have the option of writing your own. For rewrites, you can write an HTTPModule (or update your CMS's rewrite module). For redirects, you can use a custom 404 page to handle redirects. I have done both for DotNetNuke. Rolling my own took about 16 hours, but handles a few hundred thousand of each efficiently with caching.

<redirect url="index.aspx" to="~/Pages/1/home.aspx"></redirect>

Related

htaccess VS safe redirect manager

I'm updating a WP theme, changing permalinks, and also migrating to https at same time. Have 1 wildcard redirect (removing categories from URL) and about 140 manual redirects (old joomla links). Need advice between going with htaccess or Safe Redirect Manager. My only concern is page load speed, not extensible features or tracking.
It would seem like htaccess would always be the fastest but my htaccess file is 20kb (because of all the manual redirects). And so I wonder if loading a php plugin on every request (however all redirects intelligently cached) is faster. SRM might seem like the better option considering all the manual redirects but I'm wondering if there are some old-school htaccess phreaks who might say otherwise. I don't want to go through the hassle of testing.
The best solution would probably be to put your redirects in the main Apache config. Then this is only processed once when the server is started, rather than a 20kb htaccess being parsed for every request. As for your other option, not sure on the performance impact.

SSL and relative URLs in site links and redirections

I have been working on a website in beta phase for some time now, and am finally about to launch it. There are several links, anchor tags, with relative URLs throughout the site that link to the admin and cart sections of the website, and now they have to be SSL secured.
Also, same question for relative URLs in Response.Redirect("~/../..");
When a user is browsing over http, is there anyway to redirect them to a page with https connection using a relative URL? It seems like poor practice to code absolute URLs for links and redirections for the purpose of SSL. If the domain name changes, I have to rewrite them all. Plus, if I want them to work on my localhost, I would have to change them every time I upload to server. There must be some solution.
Switching Between HTTP and HTTPS Automatically is a very good code to use for the implementation of switching logic fast and easy - and not change your existing code.
Similar: Preparing my ASP.NET / MVC site to use SSL?
These helper methods by Rick Strahl will help you
http://www.west-wind.com/weblog/posts/2007/Sep/18/ResolveUrl-without-Page
Pay special attention to ResolveServerUrl.
Depending on what version of IIS you are running, you could always offload this functionality to the webserver. Check out the URL Rewrite module here.

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

Redirect subdomain to subfolder of another subdomain

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.

SEO friendly 301 redirect .htm to .aspx

I currently have a small-midsize website with .htm extensions. I have redesigned the full website, this time using a .aspx extension. I want to issue 301 redirects to keep my search engine rankings, but am unsure of how to do so from an .html page in a spider friendly way. With research I have repeatedly encountered references to ISAPI redirects (but no where can I seem to find a full explanation, just a link to isapiredirect.com, which does not load). Other than this I have been advised to run all .htm pages through the asp.net engine and issue a redirect through asp code. I have no idea how to get that done.
I am unfamiliar with asp.NET (the new site was not designed by me), and only with LAMP, which seems far more simply managed with .htaccess.
Thank you so much for any help, time, considerations or suggestions
You can use a .htaccess file if you get a license to the Helicon's ISAPI Rewrite module. It might be a familiar environment for you. But you are right, the home page doesn't load.
http://www.seoconsultants.com/windows/isapi/
Here's a link to some information about the product. It does work, it's a good product. I'm not sure I'd recommend ordering it while the vendor's site is down though.
EDIT
The vendor site is back up and here: http://www.helicontech.com/isapi_rewrite/

Resources