Rewrite the URL in ASP?

M

McKirahan

Advo said:
Hey.

Basically Ive got an url:

www.thepagename.com/town_page.asp?town_name=WHATEVER

Basically need that to be written and shown in the browser like:

www.thepagename.com/WHATEVER.html

notice how i've added the .html, thats for our Search Engine
Optimisation, or it may not be needed? i dunno.

Any ideas please?

Ive done this in PHP before, but never with ASP.

Thanks in advance!

Option Explicit
Const cURL = "www.thepagename.com/town_page.asp?town_name=WHATEVER"
Dim strURL '= www.thepagename.com/WHATEVER.html
strURL = Left(cURL,InStr(cURL,"/"))
strURL = strURL & Mid(cURL,InStrRev(cURL,"=")+1) & ".html"
Response.Write cURL & "<br>" & strURL
 
D

Daniel Crichton

Advo wrote on 4 Aug 2006 05:44:06 -0700:
Hey.

Basically Ive got an url:

www.thepagename.com/town_page.asp?town_name=WHATEVER

Basically need that to be written and shown in the browser like:

www.thepagename.com/WHATEVER.html

notice how i've added the .html, thats for our Search Engine
Optimisation, or it may not be needed? i dunno.

Any ideas please?

Ive done this in PHP before, but never with ASP.

Are you sure you did it in PHP? I think you'll find it was mod_rewrite which
is an Apache add-on.
Thanks in advance!

You'll need something like ISAPI_Rewrite (http://www.isapirewrite.com/)

Dan
 
A

Advo

is there anything that you dont have to pay for though? Basically, its
only for a simple task, therefore the boss didnt really want to have to
buy anything to get it working :s
 
A

Anthony Jones

Advo said:
Hey.

Basically Ive got an url:

www.thepagename.com/town_page.asp?town_name=WHATEVER

Basically need that to be written and shown in the browser like:

www.thepagename.com/WHATEVER.html

notice how i've added the .html, thats for our Search Engine
Optimisation, or it may not be needed? i dunno.

Any ideas please?

Ive done this in PHP before, but never with ASP.

Thanks in advance!

Unfortunately ASP doesn't provide a way to do this. This is an ISAPI level
thing you'd need to write binary component to do this.

Have considered turning the problem around the other way.

Hand out the URL:- www.thepagename.com/WHATEVER.html

Then make town_page.asp your custom 404 handler. Internally it will need to
adjust the returned status code and parsing the query string for the correct
info is messy but it should work.

Just a thought,

Anthony.
 
K

Kyle Peterson

no money , no honey

asp cant do it alone... you need a filter

there is like one free one... but the pay ones work a lot better in my
opinion
the free one I used lcked up the site periodically
 
A

Adrienne Boswell

Hey.

Basically Ive got an url:

www.thepagename.com/town_page.asp?town_name=WHATEVER

Basically need that to be written and shown in the browser like:

www.thepagename.com/WHATEVER.html

notice how i've added the .html, thats for our Search Engine
Optimisation, or it may not be needed? i dunno.

Any ideas please?

Ive done this in PHP before, but never with ASP.

Thanks in advance!

As others have said, ASP cannot do this by itself.

However, search engines do not need to have the html extension, they can
use anything, as long as they can get to the content.

Here's my suggestion to you:
1. Write valid markup - use strict HTML 4.01 or if you have need for it
Strict XHTML 1.0
2. Use semantic markup - if something is a heading, use a heading
element. If it's a navigation list, use an unordered list. If its a
paragraph, use a paragraph. Use tables for their intended purpose,
tabular data. Do not use tables for presenation or postioning of
elements.
3. Separate content from presenation. Use no presenational markup at
all, and put all your presentation into an external stylesheet. I'll go
one further with that, and suggest one for positioning, and another for
colors only.
4. Put all javascript into an external file. Don't include it in the
page unless you absolutely have to.
5. Don't use document.asp?id=123. Google and others seem to not like id,
perhaps they think they are going on an endless loop.
6. For links that really don't matter, ie, document.asp?color=green, you
can tell Google and others not to follow like this: <a
href="document.asp?color=green" rel="nofollow">See the site in green</a>.
7. Have a valid robots.txt file, but do not rely on it to keep bots away
from places they should never go.
 
J

Jeff Cochran

ISAPIRewrite has a limited free version. Did you even look at the
URL?

Jeff
 

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,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top