Creating SEO friendly urls in Classic ASP - asp-classic

I have to make all links SEO friendly on our website.
I have the following url: http://newark.storeboard.com/board.asp?RegionID=353&ClassAdCatID=740&IsEvent=1&IsCoupon=0&IsBlog=0
I need it be: http://neward.storeboard.com/classifieds/events/ConcertsLiveMusic
I have no way of accessing the IIS so this has to be done thru code. Any ideas about how to achieve this would be greatly appreciated.
Many Thanks,
Paul

The standard way of solving this as far as I know is to use a rewrite engine in IIS (such as ISAPI_rewite or IIS7 url rewrite module)
However, you don't have access to IIS you say... That makes it tricky. Two thoughts come to mind:
1) Could you create a dynamic (asp) 404 page that then looks at the request header and does a transfer according to the page requested?
2) Or, and this is rather lame, could you create a static folder structure that goes some way to looking like that url structure?

If you upgrade to IIS7 and use ASP.Net then you can control the URL rewrite module from your code.
I've done something similar to Matts suggestion 1 in the past and it can work. The important thing is you make the 404 page directly feed the true page content and not do a redirect. Otherwise your defeating the point of SEF URLs for SEO gain.
From the few references I still have to the code. asp has a Server.Transfer() function but you may have issues that you can't pass query string parameters. I think I ended up streaming the real page through the 404 page using the MSXMLServerXMLHTTP object and Response.BinaryWrite().

Related

Asp.net 2.0 Hide Default.aspx from Url

I have one issue with my site. I need to hide Default.aspx from Url. My web site project uses urlrewriter net and I tried using it to make this but no success.
I read lot of articles on net how to do this but nothings work.
Does this is only possible to set on IIS ?
I wont all ways to have www.test.com instead of www.test.com/default.aspx
Please for best solution ?
If you're using iis 7 or above, this might be a way of going about it.
The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find. You can use the URL Rewrite module to perform URL manipulation tasks.
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
And heres a link to see the module in action.
http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
After reading tons of articles this is solution for my problem..
setting this javascript onto masterpage
var testremove = location.href.toLowerCase().indexOf("default.aspx");
if (testremove != -1) {location.replace(location.href.substring(0,testremove))};

is it possible to do URL re-write in asp.net?

I have developers working on a site for me, they have told me there is no possible way to re-write the URL so there is no second level category e.g.
Remove "/category" from this URL http://www.somesite.com/category/page.aspx
I understand that page.aspx can simply go in the root folder on the server however I don't want to do this as adding heaps of pages will slow down server load time
Do not believe them... It's easy and can be done for example by UrlRewriter.net library which is easy to use and open source. Also they can write own rewriter which is also not more then an hour of work, for example like here.
check whether it will helpful for your requirement: URL Rewriting in ASP.NET

Best practices for converting an existing website into a website with SEF URL

I've got a website that was created about an year ago and its been constantly revised since then. The website is coded in classic ASP, contains about ~50 pages -- some are multi-purpose, and contains old-school style links such as:
/news.asp?PageIndex=4
/news.asp?SearchString=Obama
/news.asp?SearchString=Obama&PageIndex=4
/news.asp?NewsID=1
I have IIRF v2 installed which allows access to URL rewriting functionality so this I do not have to worry about. What I am worried about is how to replace about 300 links to .ASP pages with SEF urls. As far as my understanding is concerned, I have to add a database query (to extract title of the record being linked) for each link.
I need advice on how to begin converting the website into a SEF URL powered website with as little code change as possible. Wrapper classes and tried-and-tested techniques and pointers to best practices will be appreciated.
If you want to do URL Rewriting without changing frameworks or anything, may I suggest that you take a look at IIS7 Url Rewriting Module?
However, if you are rewriting part of your application in .NET ... you might want to consider ASP.NET MVC. It already build simple built-in URL Rewriting module and definitely allows you to keep on using your old "WebForms" (if ASP.NET) or your classic ASP pages.
Don't forget to permanently redirect each and every old link to a new one (use 301 HTTP code).
At news.asp (and whatever other old pages you have) put something (a class? I don't know, I have never used ASP) that parses the old-style URL and redirects (with a HTTP redirect code) to the new URL.
I'm not trying to be funny here but seriously how long would it really take to convert 300 links manually? I really suspect that it would take less time than trying to find some automated approach.

implementing rewrite for http://site/NICK => http://site/profile.aspx?nick=NICK

hey guys, like the title says, how can i accomplish this sort of a rewrite as simple as possible? is it with httphandlers or perhaps the asp.net routing? i am using version asp.net 3.5.
the problem is that i want any other requests to be ignored, like requests to .aspx files, images, folders and such for example:
i want these to get handled:
site.com/john => site.com/profile.aspx?nick=john
site.com/mark => site.com/profile.aspx?nick=mark
site.com/fred => /site.com/profile.aspx?nick=fred
i DONT want these to get handled:
site.com/page.aspx
site.com/images/logo.jpg
your suggestions are appreciated :)
Scott Guthrie has a great post about this. If you're running IIS7, it's super easy with the URL Rewrite module.
this
Request.Url.ToString()
gets you the url (if the page i found this on is correct, i don't use asp.net very often)
you can use some regex on this URL, maybe some kind of...
site\.com/([\w])+$
don't know how to read the capturing parts of regex with .net, there must be an appropriate object.
then send a redirect to the user, you should be able to do this using the appropriate Redirect-HTTP-Header. if i'm right, there is a similarly named collection in the Response-Object.
note that this implementation does not allow rewriting
site.com/john/some_other_param
if you have questions on how to implement this in detail, i'll try to research further
regards
I've used UrlRewriter.net in the past to do this. It works really well. You can configure it to only apply the rewrite rules if there is NOT an existing file that maps to the url (ie, real aspx pages or image files)
http://www.urlrewriting.net
Of course, if you're using IIS7 there is built in routing to do this.

How to SEO friendly an existing ASP .NET 3.5 web application under IIS6

So, I know there's a lot of this subject here and over the Internet. But most articles/questions refers to "static" url rewriting, like:
www.site.com/products.aspx?category=Books
So they rewrite it to
www.site.com/Products/Books
That's ok but I need something else.
The site is like a CMS, it has different types of content.
Nowadays to read the article titled "How StackOverflow helps you in your development" you need to go to an URL like the following.
www.site.com/viewContent.aspx?Id=1234
What I want to achive is:
www.site.com/Content/Articles/how-to-stackoverflow-helps-you-in-your-development
So as I understand, I need to involve ASP .NET in that, because first I need to retrieve the article (an its title of course) and then rewrite the URL.
But I'm wondering how the hell ASP .NET will know how to get that article if I go to that URL, it doesn't include the id anywhere...
So maybe I could accept something like
www.site.com/Content/Articles/1234/how-to-stackoverflow-helps-you-in-your-development
I'm kind of lost here really.. I've never done any URL Rewriting at all and I've googled a lot and I cannot find a way to do what I want. Maybe what I want is not called url rewriting??? I don't know...
The site is running under Windows 2003 Server, IIS6, ASP .NET 3.5 SP1
And of course, I need a free solution, cannot spend 100usd on the ISAPI mod (besides I don't know if that is going to do what I need).
Thanks to all and sorry if this is a duplicated question, but I couldn't find it.
EDIT: I don't need to support non-ASP.NET files (jpgs, gifs, etc) don't need to be rewritten. I just need to rewrite the viewContent page to include the content title into the URL.
You can use the new Routing that comes with ASP.Net 3.5 sp1 to have clean URLs.
This can even be done in web forms and not just MVC. ( I have done it myself). See here and here for exanples of how to set it up.
You can throw the Id of the article and the title in the URL and make the Id the real parameter that gets used to search for the article. That is what SO does. Try removing the question for the URL and it will take you to the same place.
Even if you don't use the Id you can pass the title of the article "how-to-stackoverflow-helps-you-in-your-development" to your DB and retreive the article based on the title.
With regards to IIS 6 it is a little trickier since IIS 6 by default can't handle extension-less URL's.
There are a few work arounds:
Use the wildcard mapping in IIS to map all requests to Asp.Net
Put Default.aspx at the end of your urls
See this post for other possible solutions.
Although the first solution may have performance issues if all content in your site goes through Asp.Net (even images, css, .html ...) in a small site it shouldn't matter. I have used this approach and there wasn't any major performance issues. I think it is the simplest solution. Here is the website I built with it
I hope this helps.
This one is free, I have used it and it works pretty well: http://www.codeplex.com/IIRF
The nice thing is that it will handle url's without an extension (i.e. .aspx, .html, etc.)
You can achieve this with ASP.NET routing.You can do this with ASP.NET MVC as well as Webforms.No need to do anything with IIS.
Check the below link
https://web.archive.org/web/20201205221404/https://www.4guysfromrolla.com/articles/051309-1.aspx#postadlink
I did URL routing in my web application within 1 hour with the details from the above link.Its quite simple to learn .They provide sample codes too.It will help you to do it easily
You can retrieve the Id of the content using the title.But title should be unique.You can use ajax to check whether the title is a already existing one when user takes mouse out from the textbox.
Easiest way is to add a http module to your current webforms project.
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
This shows you the basics of it, But it can easily be expanded so that the pages you want to rewite is taken from a database or even built on the fly.
ASP.net MVC is your friend for that
stackoverflow use MVC

Resources