| Subject: | Re: ASP script 301 Redirect no-www to www | |
|---|---|---|
| From: | Robbo () | |
| Date: | Oct 17, 2007 11:41:31 am | |
| List: | com.googlegroups.google_webmaster_help-indexing | |
Mike
The global.asa is not executed for each page access so it can be used ok IF the visitor gets redirected to another domain and then stays on the new domain.
Correct me if I am wrong, but I think that global.asa is not suitable in most cases because AFAIK the events that you can specify in the global.asa are:
Application_OnStart Application_OnEnd() Session_OnStart Session_OnEnd
Often webmasters need to redirect ASP pages within a site (rather than moving the entire site to a new domain). In those circumstances, the global.asa is not suitable because only the first requested URL at the beginning of the session would be checked by the global.asa and the visitor may be accessing a mixture of several redirected and non- redirected pages.
If you have managed to get the global.asa to handle subsequent page- request redirections within the same session, it would be good to see how that was done.
Robbo
On Oct 17, 7:07 pm, digitalsignal10101 wrote:
Thanks, Robbo. Yes, I'm using ASP/VBScript.
I am able to do the redirects on .asp pages, even using the global.asa file, but was stuck with the .htm pages
Your folder/file workaround looks interesting, I will give it a try.
Thanks again, Mike
On Oct 17, 11:41 am, Robbo wrote:
digitalsignal10101 asked:
Does anyone out there successfully use ASP scripting for 301 redirects,
including on existing .htm files?
Yes, I am webmaster for several IIS/ASP sites (as well as several Apache/PHP sites).
The global.asa that you mention is not suitable in this case.
If you cannot get the redirection done at the IIS server configuration, you can do it on a page by page basis.
You simply put the following script into the head of each ASP page that you want to redirect: <% newURL="http://www.mysite.com/abc.asp" Response.Clear() Response.Status="301 Moved Permanently" Response.AddHeader "Location", newURL Response.Flush() Response.End() %> (Note it doesn't really matter if you leave off th Response.Clear(), the Flush and the End.) The above method is simple to implement and you can use it incrementally - testing each page redirection as soon as you do it.
If you have a lot of ASP pages to redirect, you can use a centralized script in a file that is "included" by each page. Basically, that uses a CASE statement and a list of OLD page names and the appropriate newURL.
To redirect a page request from /oldfolder/myoldpage.htm to a new URL, you can use the following: 1. Delete the page /oldfolder/myoldpage.htm 2. Create a folder (sic folder) called /oldfolder/myoldpage.htm 3. Inside that new folder put a file called default.asp with only the 301 redirection script as above.
I have assumed that ASP/VBScript is the default language on your server, otherwise adapt accordingly.
I hope this helps.





