Permanent redirect in Orchard CMS (1.5) - iis-7

I recreated an old website using Orchard CMS but there is a bunch of legacy links in various search engines that I want to redirect to their Orchard counterparts. I know I need to modify web.config but I am not sure how.
EDIT:
Found this site http://iis7-rewrite.heroku.com/ that does 301 rewrites for web.config

Yes, you can use web.config, in which case what you need to read is the IIS documentation on the subject, or you can use the Rewrite Rules module.

This is a general ASP.Net topic, not an Orchard-specific one. Depending on your server, you can use different way to do it. If you are using IIS 7 and above, then the task is easier as you can do it in web.config. Search IIS 7 URL Rewrite for more information, or try this as a starter http://blogs.msdn.com/b/carlosag/archive/2008/09/02/iis7urlrewriteseo.aspx

Related

Different domain names pointing to subfolders in Azure

Not sure if what I'm describing is possible, but if so I'd like to know how.
I have an ASP.NET Azure Shared mode website with a domain, lets say mydomain.com pointing to it. I have a shop there, which is currently at mydomain.com/shop.
What I'd like is to point a different domain, myshop.com to the page at mydomain.com/shop. Can I do that?
Probably the quickest approach would be URL-Rewriting, which is installed by default on Azure Website / WebRole.
Configuration can be made in the web.config -> more details although you I would imagine if you're using MVC there might a slightly more elegant Routing method, maybe?
I'm not sure if I get your question right, but
you could use the HttpResponse Redirect from the .net framework in order to redirect the response.

Is there a way I can redirect/rewrite URLs is IIS 7 when the application runs the .NET Framework 1.1?

Is there simply a way I can update the web.config file to rewrite or redirect URLs without making code changes to the project?
Before IIS7 came out, I used a URL Rewrite Module from Helicon to do similar things. It's based on regex for the rules, but it's pretty good and it always worked well for me.
It's an ISAPI module, so it's configuration is outside of web.config.
I used the ISAPI_Rewrite_Lite product, which is free. I never used the full-blown version.
I hope this helps.

Help in locating the URL rewrites in place for an asp.net website

First off i'll advise i'm not familiar with implementing url re writing on any level.
That said I do know there are 2 types or rewrites setup for this site.
One I can locate and is solely responsible for top level rewrites (turning .com to .co.uk)
There is another rewriter implemented somehow somewhere, very early on in a pages lifecycle and I cannot find how or where the site is doing this. It's possible it's all handled in a 3rd party DLL but I would like to know the steps I might go through to prove or disprove this.
Thanks
What does your web.config have registered in the httpModules section? Often URL Rewriters are registered very early in the request life cycle. httpModules and httpHandlers can grab the request here. This is of course assuming you've ruled out IIS redirects. After that you can look for manual redirection in the global.asax file. There are a lot of places to look when you don't know how the original coder decided to implement the idea. I've seen some bad places, including in the constructor of a common base page inherited by every page on the site.
URL rewriters are typically ISAPI filters - you can search currently applicable ISAPI filters on Web Site or Folder properties in IIS 6 (you might have ISAPI filters in right context menu), on II7, ISAPI filters in features view when you select web site or folder.
With .NET 3.5 or 4.0, its possible that ASP.NET routing might be the reason - you can locate that in web.config or global.asax (common places for putting the routes).
My word i'm so sorry after finally tracking down an original dev there is no re-writes whatsoever. The solution is complex but workable. Weird etc :). Love IT.

How to do 301 redirects in asp.net from old Apache mod_rewrite style urls when moving a site from php to asp.net?

I have an existing site in php running on Apache using the mod_rewrite plug-in. In other words, I currently have urls like www.example.com/section/subsection/ which Google and others have indexed.
However, the site needs a major upgrade, and I would like to move it to asp.net. I only have the option of using a shared hosting solution (iis 6, aps.net 3.5, full trust). So my question: How do I make asp.net do a 301 redirect from my old urls like www.example.com/section/subsection/ to their equivalent ones on the new asp.net site?
I obviously needs this to not loose the current rankings in the search engines.
Thanks, Egil.
If you use the ASP.NET MVC framework it has a URL rewriting system built into it.
You can manually add 301 redirects into IIS using IIS Manager if you want to set up "moved" locations.
If you want to do URL re-writing then you will need to implement IHttpModule, hook up the BeginRequest event, and add that new class to the httpModules section in Web.config.
Okay...so this may be overkill and could possibly be done another way in two lines..BUT...
If you are keeping the same domain name then what I've done in the past is keep a table of old urls and how they map to new urls. On the application's request, I'll scan the table, if an old url is found then I'll add a header that does a 301 redirect to the new URL.
According to Steve Sanderson’s blog post Deploying ASP.NET MVC to IIS 6 it do not look like there is an option to do url rewriting/redirection with IIS6 in a shared hosting set up, where you cant manually configure IIS. Gah...

IIS7: URL rewrite http://web1.com/web1/def.aspx to http://web1.com/def.aspx

I have to have my website stored in a subfolder of my domain root. Is there a way to rewrite the URLs so that it doesn't appear to be stored in a subfolder? It doesn't matter to me if this is done at the IIS level or in the web.config.
Have you looked at the routing engine that came out of the MVC project but is now a stand-alone feature of the .NET Framework?
With IIS7, the way to go is probably the module that Microsoft themselves put out:
http://blogs.iis.net/ruslany/archive/2008/11/10/url-rewrite-module-release-to-web.aspx
In previous releases, there were various workarounds with different downsides/costs:
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
If you decide to go with an ISAPI filter, we've had good experiences with Ionic's Isapi Rewrite. And it's free (beer and speech).
I'm using the ManagedFusion Url Rewriter on my blog. I like it because it doesn't need to be installed at the server level.
You can presumably get the behavior you want by using an ISAPI filter.
Google for: rewrite ISAPI filter and you will find some prebuilt examples to try and see what works best for you.

Resources