301 redirect HTML to ASPX. options?
301 redirect HTML to ASPX. options?
am 28.12.2007 01:03:36 von aluminum
I'm helping convert a 300+ page .html site into an ASP.net site.
The client wants to set up 301 redirects for all of the old html pages. I've
used ISAPI for this type of thing in the past, as it works great and is easy
to set up, but at this point, the client (which is my client, who's working
with the actual client) doesn't know what the new web host supports.
In the interim, I want to do a bit of research myself on this to see if it's
anything I can handle on my end. It's in asp.net 1.1 right now, and from
what I can tell, it's quite easy to add a 301 redirect to an existing aspx
page. However, these are all .html pages, so it appears I'm out of luck with
that.
Do I have any other options to pursue outside of ISAPI Rewrite?
Converting to 2.0 probably isn't an option for this project, but that would
help in the future, correct, as ALL files can be intercepted by the .net
engine, correct? If that's true, is there any way to leave the current site
as an ASP.net 1.1 site but run a 'wrapper' application of some sort in 2.0
that can handle the 301 intercept/rewrites?
-Darrel
RE: 301 redirect HTML to ASPX. options?
am 28.12.2007 02:21:00 von MohamadElarabiMCPD
You can do this in IIS. You can set IIS to redirect to a URL if a certain
page is hit. This could be done for a single page, an entire folder, or an
entire web site. To do that go to the properties window of either a page, a
folder or a website and click on the "Home Page" tab, choose the radio option
titled "A redirection to a URL" then in the test box below write the exact
URL you'd like to be redirected to. You can also use $S in that url to pass
the original url to your asp page, ans $Q will pass the original querystring.
So your url could be
http://myNewApp/myPageHandler.aspx?OURL=$S&$Q
Hope this helps.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
> I'm helping convert a 300+ page .html site into an ASP.net site.
>
> The client wants to set up 301 redirects for all of the old html pages. I've
> used ISAPI for this type of thing in the past, as it works great and is easy
> to set up, but at this point, the client (which is my client, who's working
> with the actual client) doesn't know what the new web host supports.
>
> In the interim, I want to do a bit of research myself on this to see if it's
> anything I can handle on my end. It's in asp.net 1.1 right now, and from
> what I can tell, it's quite easy to add a 301 redirect to an existing aspx
> page. However, these are all .html pages, so it appears I'm out of luck with
> that.
>
> Do I have any other options to pursue outside of ISAPI Rewrite?
>
> Converting to 2.0 probably isn't an option for this project, but that would
> help in the future, correct, as ALL files can be intercepted by the .net
> engine, correct? If that's true, is there any way to leave the current site
> as an ASP.net 1.1 site but run a 'wrapper' application of some sort in 2.0
> that can handle the 301 intercept/rewrites?
>
> -Darrel
>
>
>
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 03:34:38 von aluminum
> You can do this in IIS. You can set IIS to redirect to a URL if a certain
> page is hit. This could be done for a single page, an entire folder, or an
> entire web site. To do that go to the properties window of either a page,
> a
> folder or a website and click on the "Home Page" tab, choose the radio
> option
> titled "A redirection to a URL" then in the test box below write the exact
> URL you'd like to be redirected to. You can also use $S in that url to
> pass
> the original url to your asp page, ans $Q will pass the original
> querystring.
> So your url could be
>
> http://myNewApp/myPageHandler.aspx?OURL=$S&$Q
>
> Hope this helps.
I've done that myself, but, again, not sure what kind of access we're going
to get to the server itself, if any.
Also, there's about 300 separate URLs that they need to set redirects up
for. I really think ISAPI is the way to go, but just in case, thought i'd
check on whatever other options we might have.
-Darrel
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 05:53:00 von MohamadElarabiMCPD
You could put the old url and the new url in a sql table or a file and have
one page that looks it up in the table and redirects. You can then set one
redirect in IIS on the web site level to send all traffic to your new page
instead of 300 different ones, one for each page.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
> > You can do this in IIS. You can set IIS to redirect to a URL if a certain
> > page is hit. This could be done for a single page, an entire folder, or an
> > entire web site. To do that go to the properties window of either a page,
> > a
> > folder or a website and click on the "Home Page" tab, choose the radio
> > option
> > titled "A redirection to a URL" then in the test box below write the exact
> > URL you'd like to be redirected to. You can also use $S in that url to
> > pass
> > the original url to your asp page, ans $Q will pass the original
> > querystring.
> > So your url could be
> >
> > http://myNewApp/myPageHandler.aspx?OURL=$S&$Q
> >
> > Hope this helps.
>
> I've done that myself, but, again, not sure what kind of access we're going
> to get to the server itself, if any.
>
> Also, there's about 300 separate URLs that they need to set redirects up
> for. I really think ISAPI is the way to go, but just in case, thought i'd
> check on whatever other options we might have.
>
> -Darrel
>
>
>
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 07:05:15 von aluminum
> You could put the old url and the new url in a sql table or a file and
> have
> one page that looks it up in the table and redirects
> You can then set one
> redirect in IIS on the web site level to send all traffic to your new page
> instead of 300 different ones, one for each page.
Ah! That might work! So, IIS redirects to my page, and my page then does the
301 redirect. In that case, what kind of redirect do I use in IIS?
-Darrel
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 09:04:29 von Mark Stevens
On Thu, 27 Dec 2007 20:53:00 -0800, Mohamad Elarabi [MCPD]
wrote:
>You could put the old url and the new url in a sql table or a file and have
>one page that looks it up in the table and redirects. You can then set one
>redirect in IIS on the web site level to send all traffic to your new page
>instead of 300 different ones, one for each page.
Or make the root name of the aspx page the same as the html. You can
then replace the html in the original URL string with aspx and
redirect. That way you do not need the sql table the rest of the
redirect would remain as described.
This method also has the side effect that the structure of the site
remains the same so anyone working on the system using the old html
files will be familiar with the new layout. Effectively they are the
same.
Cheers,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)
Mark Stevens (mark at thepcsite fullstop co fullstop uk)
This message is provided "as is".
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 11:08:01 von MohamadElarabiMCPD
That would be true if he had 300 different aspx pages. But I doubt he has as
many aspx pages as his old HTML ones otherwise why bother with aspx.
My assumption is that he has a handful of aspx pages that can serve up
dynamic content that used to be hosted over 300 different html pages.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Mark Stevens" wrote:
> On Thu, 27 Dec 2007 20:53:00 -0800, Mohamad Elarabi [MCPD]
> wrote:
>
> >You could put the old url and the new url in a sql table or a file and have
> >one page that looks it up in the table and redirects. You can then set one
> >redirect in IIS on the web site level to send all traffic to your new page
> >instead of 300 different ones, one for each page.
>
> Or make the root name of the aspx page the same as the html. You can
> then replace the html in the original URL string with aspx and
> redirect. That way you do not need the sql table the rest of the
> redirect would remain as described.
>
> This method also has the side effect that the structure of the site
> remains the same so anyone working on the system using the old html
> files will be familiar with the new layout. Effectively they are the
> same.
>
> Cheers,
> Mark
> --
> |\ _,,,---,,_ A picture used to be worth a
> ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
> |,4- ) )-,_. ,\ ( `'-' came television!
> '---''(_/--' `-'\_)
>
> Mark Stevens (mark at thepcsite fullstop co fullstop uk)
>
> This message is provided "as is".
>
Re: 301 redirect HTML to ASPX. options?
am 28.12.2007 11:20:00 von MohamadElarabiMCPD
IIS would be set to redirect to a single URL as I specified in my original
post. You would right click on the web site/Properties/Home Page Tab/"A
redirection to a URL" and in the text box you'd specify the exact url to your
new redirector aspx page and pass it the old url in the query string. It
should look something like this
http://myNewAppDomain/myRedirectorPage.aspx?OldURL=$S
Note that the $S should translate to the originally requested URL and it
should come to youe aspx page in a querystring variable called OldURL. You'd
parse that value and use it to lookup the page that you'll need to redirect
to.
If your aspx page is on the same site you can specify a virtual path instead
of an http:\\... one. There are other redirection options like redirecting to
a virtual folder under the same website. Unfortunately I am unable to help
you with anymore specific details since I don't have access to an IIS6.0 box
at the mean time. All I have access to is IIS7 on my vista laptop which is
entirely different. So hopefully the IIS interface is intuitive enough for
you to maneuver, I'm sure you can figure it out at least by trial and error
if need be. Also consider doing a Server.Transfer in your redirector page to
save a roundtrip this way your clients won't take 3 requests to get to their
target.
Hope this is clearer. Let me know.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
> > You could put the old url and the new url in a sql table or a file and
> > have
> > one page that looks it up in the table and redirects
> > You can then set one
> > redirect in IIS on the web site level to send all traffic to your new page
> > instead of 300 different ones, one for each page.
>
> Ah! That might work! So, IIS redirects to my page, and my page then does the
> 301 redirect. In that case, what kind of redirect do I use in IIS?
>
> -Darrel
>
>
>
Re: 301 redirect HTML to ASPX. options?
am 30.12.2007 22:28:49 von aluminum
> That would be true if he had 300 different aspx pages. But I doubt he has
> as
> many aspx pages as his old HTML ones otherwise why bother with aspx.
Exactly. ;o)
Your answer makes sense. Though, is this HAS to be a 301 redirect. Does the
method of using the one aspx page result in (or can it result in) a 301
redirect message being sent back?
Re: 301 redirect HTML to ASPX. options?
am 31.12.2007 00:09:01 von MohamadElarabiMCPD
IF you do a response.redirect(RedirectionURLHere) then it is a 301 redirect
but if you do a Server.Transfer it won't look like a redirect to the client.
In general you want to minimize the number of 301 redirects because each one
is a round trip between the server and the client. So you set IIS to do a
redirect to your ASPX page and then your page can redirect again to the
target alternative. Now I'm not sure if the IIS redirect is a 301 or is it
seamless to the client, but my guess is that it is a 301 redirect. However,
if IIS doesn't do a 301 and you insist on having a 301 then your ASPX can do
a Response.Redirect instead of a Server.Transfer.
In any case your client will not see a page that says "This page has moved,
you will be redirected in 5 seconds, if you're not redirected click here . .
.. " because this kind of page is something you'll need to write yourself. So
if that is what you want then your aspx page will need to do so and set a
refresh on the body tag of the page.
Hope that helps.
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"Darrel" wrote:
>
> > That would be true if he had 300 different aspx pages. But I doubt he has
> > as
> > many aspx pages as his old HTML ones otherwise why bother with aspx.
>
> Exactly. ;o)
>
> Your answer makes sense. Though, is this HAS to be a 301 redirect. Does the
> method of using the one aspx page result in (or can it result in) a 301
> redirect message being sent back?
>
>
>