file renamed after server upgrade

C

c676228

Hi all,
Recently we are upgrading and merge our servers. We will move all *.html
hosted on a unix system to our windows server. During the migration, we also
upgrade almost all of our code, say almost all html pages have been renamed
to *.asp in order to handle those pages dynamically. But the issue here is
our original *.html pages are ranked very highly by search engine. We are not
sure what kind of redirect will be benign to search engines. And it seems
that there is no one-page auto redirects solution like you can do with unix
system (.htaccess file). On windows server, you have to redirect
individually. (man, think about if you have thousands of pages on a site.)
I searched a bit, the following code seems to do the job:
put this code on the top of every page I wish to be redirected:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/yournewpage.asp"
%>

am I right? But I cannot do this way in the original *.html file since it is
not *.asp code. I have to use javascript to do dynamically redirect anyway.
but what kind of redirect will be beneficial to Search Engine, the
instantaneous meta refresh redirect or the old page with all the old content
removed and having a link towards the new page, which way is better, one
click or no click to get to the new page.
 
C

c676228

Hi all,
sorry I have to change the original subject since it doesn't make any sense
 
A

Adrienne Boswell

Gazing into my crystal ball I observed =?Utf-8?B?YzY3NjIyOA==?=
Hi all,
Recently we are upgrading and merge our servers. We will move all
*.html hosted on a unix system to our windows server. During the
migration, we also upgrade almost all of our code, say almost all html
pages have been renamed to *.asp in order to handle those pages
dynamically. But the issue here is our original *.html pages are
ranked very highly by search engine. We are not sure what kind of
redirect will be benign to search engines. And it seems that there is
no one-page auto redirects solution like you can do with unix system
(.htaccess file). On windows server, you have to redirect
individually. (man, think about if you have thousands of pages on a
site.) I searched a bit, the following code seems to do the job:
put this code on the top of every page I wish to be redirected:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",
"http://www.example.com/yournewpage.asp" %>

am I right? But I cannot do this way in the original *.html file since
it is not *.asp code. I have to use javascript to do dynamically
redirect anyway. but what kind of redirect will be beneficial to
Search Engine, the instantaneous meta refresh redirect or the old
page with all the old content removed and having a link towards the
new page, which way is better, one click or no click to get to the
new page.

IIRC there is something that you can do with custom error pages.
 
E

Evertjan.

Dave Anderson wrote on 26 jan 2008 in
microsoft.public.inetserver.asp.general:
You can configure IIS to parse .html files the same as .asp.
Alternatively, you can construct a custom 404 handler. Either should
be capable of generating such a permanent redirect.

Since my servers are virtual and remote,
I use the latter option:

=========== 404.asp =============
<% ' vbs
qstr = Request.ServerVariables("QUERY_STRING")
if instr(lcase(qstr),".html")>0 then
on error resume next
x = replace(x,"404;http://www.example.com:80","")
x = replace(x,".html",".asp")
server.transfer x
on error goto 0
end if
%>
<body>
This is the 404 error page of www.example.com
</body>
==================================

Not tested, but roughly similar to my own proven 404.asp files
 
S

Steven Cheng[MSFT]

Hi Betty,

If you want to keep those html files and let the html file do the
redirection, you can consider using the html meta tag to do the
redirection. Here is the example:

#Redirect to a Different URL using the Meta Tag "Refresh"
http://webmaster.iu.edu/tool_guide_info/refresh_metatag.shtml

Also, If you have thousands of html pages that need to redirect to their
asp version ones, I think you may consider develop a custom ISAPI filter
component and plug in your IIS server which intercept those html page
requests and redirect to the ASP pages if necessary.

#Redirecting ISAPI Filter
http://www.15seconds.com/issue/961220.htm

#HOWTO: Redirect the browser to a new URL based on Referer
http://blogs.msdn.com/david.wang/archive/2005/12/06/HOWTO-Redirect-the-brows
er-to-a-new-URL-based-on-Referer.aspx

Also, if you search "ISAPI filter" and "url rewrite", you will find many
existing commerical products that do such functions.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
D

Daniel Crichton

Evertjan. wrote on 26 Jan 2008 12:49:20 GMT:
Dave Anderson wrote on 26 jan 2008 in
microsoft.public.inetserver.asp.general:
Since my servers are virtual and remote,
I use the latter option:
=========== 404.asp =============
<% ' vbs qstr = Request.ServerVariables("QUERY_STRING")
if instr(lcase(qstr),".html")>0 then
on error resume next
x = replace(x,"404;http://www.example.com:80","")

Shouldn't this be

x = replace(qstr,"404;http://www.example.com:80","")
x = replace(x,".html",".asp")
server.transfer x
on error goto 0 end if %>
<body>
This is the 404 error page of www.example.com </body>
==================================
Not tested, but roughly similar to my own proven 404.asp files
 
E

Evertjan.

Daniel Crichton wrote on 28 jan 2008 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote on 26 Jan 2008 12:49:20 GMT:
Dave Anderson wrote on 26 jan 2008 in
microsoft.public.inetserver.asp.general:
Since my servers are virtual and remote,
I use the latter option:
=========== 404.asp =============
<% ' vbs qstr = Request.ServerVariables("QUERY_STRING")
if instr(lcase(qstr),".html")>0 then
on error resume next
x = replace(x,"404;http://www.example.com:80","")

Shouldn't this be

x = replace(qstr,"404;http://www.example.com:80","")
Indeed
x = replace(x,".html",".asp")
server.transfer x
on error goto 0 end if %>
<body>
This is the 404 error page of www.example.com </body>
==================================
Not tested, but roughly similar to my own proven 404.asp files
 
C

c676228

Hi all,
Thanks for your input. I took Evertjan's suggestion and used the 404 page to
redirect all the *.html pages to *.asp page.
and just changed server.transfer to Response.Redirect x to make it work
correctly.
somehow, server.transfer just doesn't work.

thanks, thanks to Evertjan.
 
A

Anthony Jones

c676228 said:
Hi all,
Thanks for your input. I took Evertjan's suggestion and used the 404 page to
redirect all the *.html pages to *.asp page.
and just changed server.transfer to Response.Redirect x to make it work
correctly.
somehow, server.transfer just doesn't work.

thanks, thanks to Evertjan.


The problem you will have with a custom 404 page is that the request is
transfered to the 404 page via a 302 object moved response to the client.

Instead of server.transfer you might try sending your 301 response instead
of using a server.transfer in the 404 page. However I can't tell you
whether search engines are intelligent enough to apply the 301 response to
the original request URL.

A better solution would be to use an ISAPI filter to re-write the requested
URL.

Another solution would've have been to not have renamed the .html to .asp
and simply added .html to the list of file extensions handled as an ASP
script.

BTW, have you considered the impact on your system where previously static
and cachable html pages appear as dynamic content to the client. Your site
will not benefit from browser and proxy caches anywhere as much as it was.
 
E

Evertjan.

Anthony Jones wrote on 29 jan 2008 in
microsoft.public.inetserver.asp.general:

server.transfer works fine here.

Please, OP, temporarily test in your 404.asp page for the exact
querystring string by doing a nonexistant .html request before you start
coding the string manipulation:

Response.Write Request.ServerVariables("QUERY_STRING")
Response.end
The problem you will have with a custom 404 page is that the request
is transfered to the 404 page via a 302 object moved response to the
client.

If this is true, and it probably is with response.redirect, then it is
just as requested, as indeed the object is moved.

But I am using server.transfer extensively, and here, as the fysical
..html page no longer exists, the 404.asp page is immediately invoked and
with my server.transfer the .html page mimiques the real asp page and
returnss a 200 status.

I even have about 300 virtual .asp pages in a nonexistent directory on a
server sharing one real asp page and invoked via this 404.asp code if
theatdirectory name is detected. The different page names are resolved in
the single page asp-vbs code to render the required html.

Instead of server.transfer you might try sending your 301 response
instead of using a server.transfer in the 404 page. However I can't
tell you whether search engines are intelligent enough to apply the
301 response to the original request URL.

A better solution would be to use an ISAPI filter to re-write the
requested URL.

I hate that word "better".

"Another" is fine:
Another solution would've have been to not have renamed the .html to
.asp and simply added .html to the list of file extensions handled as
an ASP script.

Many of us [see below] have no access to the IIS settings they use,
but if you have, it seems a nice move. "The best" comes to mind.
;-)
BTW, have you considered the impact on your system where previously
static and cachable html pages appear as dynamic content to the
client.

I reckon most of our [this NG reader's] servers have less than a few
thousands visits a day, so the impact is unimportant for most of us.
Your site will not benefit from browser and proxy caches
anywhere as much as it was.

Not in the case of server.transfer, as to the outside cyberworld the
virtual page is just a page.
 
A

Anthony Jones

Evertjan. said:
Anthony Jones wrote on 29 jan 2008 in
microsoft.public.inetserver.asp.general:


server.transfer works fine here.

Please, OP, temporarily test in your 404.asp page for the exact
querystring string by doing a nonexistant .html request before you start
coding the string manipulation:

Response.Write Request.ServerVariables("QUERY_STRING")
Response.end


If this is true, and it probably is with response.redirect, then it is
just as requested, as indeed the object is moved.

After some testing it seems this behaviour is historical. I can only
reproduce it on IIS 5.0 when the original request is for an ASP page.
Otherwise the redirect is handled internally by IIS.
But I am using server.transfer extensively, and here, as the fysical
.html page no longer exists, the 404.asp page is immediately invoked and
with my server.transfer the .html page mimiques the real asp page and
returnss a 200 status.

I even have about 300 virtual .asp pages in a nonexistent directory on a
server sharing one real asp page and invoked via this 404.asp code if
theatdirectory name is detected. The different page names are resolved in
the single page asp-vbs code to render the required html.

Instead of server.transfer you might try sending your 301 response
instead of using a server.transfer in the 404 page. However I can't
tell you whether search engines are intelligent enough to apply the
301 response to the original request URL.

A better solution would be to use an ISAPI filter to re-write the
requested URL.

I hate that word "better".

"Another" is fine:
Another solution would've have been to not have renamed the .html to
.asp and simply added .html to the list of file extensions handled as
an ASP script.

Many of us [see below] have no access to the IIS settings they use,
but if you have, it seems a nice move. "The best" comes to mind.
;-)
BTW, have you considered the impact on your system where previously
static and cachable html pages appear as dynamic content to the
client.

I reckon most of our [this NG reader's] servers have less than a few
thousands visits a day, so the impact is unimportant for most of us.

Could be but equally I reckon the many maintain ASP sites that get way more,
for example intranet sites.
Not in the case of server.transfer, as to the outside cyberworld the
virtual page is just a page.

Except that the static content handler in IIS will automatically generate
ETag and Last-Modified headers and respond with 304 when appropriate. Where
as ASP will only do that if you so code it to.

This is particularly significant where with returning visitors, most of
which will be using IE and most of which will do so with default settings
which will typically ignore fresh content in the cache the first time URL is
fetched in a IE session.

I stated in my orignal response its something to consider but you are
correct that there is a good chance this isn't significant.
 
C

c676228

Hi all,

Anthony's comments make me think the solution again. We cannot afford to
lose traffic. I have to do some more research and get back to you again a
couple of days later since so far I cannot completely understand the
situation yet.
--
Betty


Anthony Jones said:
Evertjan. said:
Anthony Jones wrote on 29 jan 2008 in
microsoft.public.inetserver.asp.general:


server.transfer works fine here.

Please, OP, temporarily test in your 404.asp page for the exact
querystring string by doing a nonexistant .html request before you start
coding the string manipulation:

Response.Write Request.ServerVariables("QUERY_STRING")
Response.end


If this is true, and it probably is with response.redirect, then it is
just as requested, as indeed the object is moved.

After some testing it seems this behaviour is historical. I can only
reproduce it on IIS 5.0 when the original request is for an ASP page.
Otherwise the redirect is handled internally by IIS.
But I am using server.transfer extensively, and here, as the fysical
.html page no longer exists, the 404.asp page is immediately invoked and
with my server.transfer the .html page mimiques the real asp page and
returnss a 200 status.

I even have about 300 virtual .asp pages in a nonexistent directory on a
server sharing one real asp page and invoked via this 404.asp code if
theatdirectory name is detected. The different page names are resolved in
the single page asp-vbs code to render the required html.

Instead of server.transfer you might try sending your 301 response
instead of using a server.transfer in the 404 page. However I can't
tell you whether search engines are intelligent enough to apply the
301 response to the original request URL.

A better solution would be to use an ISAPI filter to re-write the
requested URL.

I hate that word "better".

"Another" is fine:
Another solution would've have been to not have renamed the .html to
.asp and simply added .html to the list of file extensions handled as
an ASP script.

Many of us [see below] have no access to the IIS settings they use,
but if you have, it seems a nice move. "The best" comes to mind.
;-)
BTW, have you considered the impact on your system where previously
static and cachable html pages appear as dynamic content to the
client.

I reckon most of our [this NG reader's] servers have less than a few
thousands visits a day, so the impact is unimportant for most of us.

Could be but equally I reckon the many maintain ASP sites that get way more,
for example intranet sites.
Not in the case of server.transfer, as to the outside cyberworld the
virtual page is just a page.

Except that the static content handler in IIS will automatically generate
ETag and Last-Modified headers and respond with 304 when appropriate. Where
as ASP will only do that if you so code it to.

This is particularly significant where with returning visitors, most of
which will be using IE and most of which will do so with default settings
which will typically ignore fresh content in the cache the first time URL is
fetched in a IE session.

I stated in my orignal response its something to consider but you are
correct that there is a good chance this isn't significant.
 
C

c676228

hi Anthony,

you mentioned that:

"Another solution would've have been to not have renamed the .html to .asp
and simply added .html to the list of file extensions handled as an ASP
script. "

It sounds attractive to after I read your message carefully. So we don't
need to worry about losing traffice anymore, same pages as before, only a bit
confusing to programmer.
But how to set it up in IIS? can you instruct?
Thank you so much for your contribution.
 
D

Dave Anderson

Anthony said:
Another solution would've have been to not have renamed the .html to
.asp and simply added .html to the list of file extensions handled as
an ASP script.

I wonder where I heard that before?

Oh, yeah:
[In his initial response to the OP] Dave Anderson wrote:
You can configure IIS to parse .html files the same as .asp.
Alternatively, you can construct a custom 404 handler. Either
should be capable of generating such a permanent redirect.
 
C

c676228

Sorry, Dave. I messed up.
It's your statement. I guess my eyes are just crooked.
:=(
--
Betty


Dave Anderson said:
Anthony said:
Another solution would've have been to not have renamed the .html to
.asp and simply added .html to the list of file extensions handled as
an ASP script.

I wonder where I heard that before?

Oh, yeah:
[In his initial response to the OP] Dave Anderson wrote:
You can configure IIS to parse .html files the same as .asp.
Alternatively, you can construct a custom 404 handler. Either
should be capable of generating such a permanent redirect.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
 
S

Steven Cheng[MSFT]

Hi Betty,

Have you had a look at the other url redirection reference I provided
previously:

#Redirect to a Different URL using the Meta Tag "Refresh"
http://webmaster.iu.edu/tool_guide_info/refresh_metatag.shtml

Also, If you have thousands of html pages that need to redirect to their
asp version ones, I think you may consider develop a custom ISAPI filter
component and plug in your IIS server which intercept those html page
requests and redirect to the ASP pages if necessary.

#Redirecting ISAPI Filter
http://www.15seconds.com/issue/961220.htm

#HOWTO: Redirect the browser to a new URL based on Referer
http://blogs.msdn.com/david.wang/archive/2005/12/06/HOWTO-Redirect-the-brows
er-to-a-new-URL-based-on-Referer.aspx

Also, if you search "ISAPI filter" and "url rewrite", you will find many
existing commerical products that do such functions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.






--------------------
 
A

Anthony Jones

c676228 said:
hi Anthony,

you mentioned that:

"Another solution would've have been to not have renamed the .html to .asp
and simply added .html to the list of file extensions handled as an ASP
script. "

It sounds attractive to after I read your message carefully. So we don't
need to worry about losing traffice anymore, same pages as before, only a bit
confusing to programmer.
But how to set it up in IIS? can you instruct?


In IIS manager open the properties dialog on the web site.

On the home directory tab click the Configuration... button under
application setttings.

On the App Mappings tab of the Application Configuration dialog you will see
a list of file extensions and the dll they are mapped to.

Note the executable path of the .asp extension (likely
c:\windows\system32\intetsrc\asp.dll).

Click Add and enter the same executable path in the Executable box.
Enter .html in the Extension box
Limit verbs to GET, HEAD, POST, TRACE
Leave script engine check box ticked.

OK out the dialogs

Now .html are handled as .asp pages. Note that this also brings about the
changes in the header behaviours I've mentioned before.

If your site is already busy these changes will make it work significantly
harder.
 
C

c676228

Hi Steven,

I looked at three options you mentioned here.
for the first one, meta tag refresh, some articles mentioned that Search
Engine doesn't like that because of some spammer use this to redirect a user
to an irrelevant advertising site.
Second option, I am not sure if I understand correctly. it seems that it's
better solution for site restructure. We don't change site map, not change
all *.htm files to *.asp, but the majority of them. So it is not the most
proper solution in our case.

Third opiotn, my problem is I am lack of knowledge about ISAPI. So it is
kind of for me understand it.

So now I am trying to make a decision from these contributoers' suggestions
and comments. Which one is better? 404 custom error page redirect or set
*.html run just like *.asp in IIS. I don't know at all.
--
Betty


Steven Cheng said:
Hi Betty,

If you want to keep those html files and let the html file do the
redirection, you can consider using the html meta tag to do the
redirection. Here is the example:

#Redirect to a Different URL using the Meta Tag "Refresh"
http://webmaster.iu.edu/tool_guide_info/refresh_metatag.shtml

Also, If you have thousands of html pages that need to redirect to their
asp version ones, I think you may consider develop a custom ISAPI filter
component and plug in your IIS server which intercept those html page
requests and redirect to the ASP pages if necessary.

#Redirecting ISAPI Filter
http://www.15seconds.com/issue/961220.htm

#HOWTO: Redirect the browser to a new URL based on Referer
http://blogs.msdn.com/david.wang/archive/2005/12/06/HOWTO-Redirect-the-brows
er-to-a-new-URL-based-on-Referer.aspx

Also, if you search "ISAPI filter" and "url rewrite", you will find many
existing commerical products that do such functions.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?YzY3NjIyOA==?= <[email protected]>
References: <[email protected]>
Subject: RE: redirect search engine highly ranked page
Date: Fri, 25 Jan 2008 14:55:01 -0800
 
S

Steven Cheng[MSFT]

Thanks for your reply Betty,

As for the two suggestion from the communtiy guys, I haven't used the "404
page" approach so I can not give you much comments on it. For running
"*.html" like asp in IIS, I think it is workable just like you configure
html or other static page to be processed by ASP.NET runtime(here you
configure it to be processed by ASP runtime extension), however, one
drawback here is that all the html static files are processed by ASP
extension and if you have some real "html" files(which are originally
processed by IIS directly), you'll lose some performance.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?YzY3NjIyOA==?= <[email protected]>
References: <[email protected]>
Subject: RE: redirect search engine highly ranked page
Date: Wed, 6 Feb 2008 13:58:04 -0800
Hi Steven,

I looked at three options you mentioned here.
for the first one, meta tag refresh, some articles mentioned that Search
Engine doesn't like that because of some spammer use this to redirect a user
to an irrelevant advertising site.
Second option, I am not sure if I understand correctly. it seems that it's
better solution for site restructure. We don't change site map, not change
all *.htm files to *.asp, but the majority of them. So it is not the most
proper solution in our case.

Third opiotn, my problem is I am lack of knowledge about ISAPI. So it is
kind of for me understand it.

So now I am trying to make a decision from these contributoers' suggestions
and comments. Which one is better? 404 custom error page redirect or set
*.html run just like *.asp in IIS. I don't know at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top