URL rewritings on Classic ASP 3.0 without IIS configurations!

Salam Alikum and Hello there,,,

I found this questions online, some people still using classic ASP like me and asking is there is anyway to do a real url-rewriting in classic ASP? and is that really possible without IIS configuration ?

All those new .net jeeks can easily implement a simple sitemap.xml to perform a simple url-rewriting without much effort, but in classic ASP the life is really hard, but more logical, at least for me… 

In this article I will show you how to create a really dynamic url-rewriting in classic ASP without configuring your IIS or anything . 

First what is URL-rewriting ?

I consider you know what it is, but I will tell you again, simply it is a different way to present a page on your site using a fake/not-real url

Why are we using URL-rewriting ?

Four reasons…

First, the url would look much elegant and expressive, and you can choose any or multiple names and extensions to one or more pages .

Second, because urls to pages and contents are much elegant and expressive, search engines can easily crawlers site pages, especially with .html extension and without much query strings and question marks.

Third reason, is to keep your site without any broken links, say you have an old links, you still can redirect those links to new pages without losing visitors by letting them see the nice Page Not Found message.

Reason number four, is ‘Security’, yes, no one knows what is your real Asp pages, it will be hard for normal users to know what is your server language or platform, and/or you can frequently change the url of a certain page to anything, more over you can redirect multiple links to one page, and of course you’re sure any update to the original page will reflect on those links’ pages.

How it looks like ?

A url like …
after applying url re-write it would be like

Please notice, there is no such htm page on your web server, but as you see, it works and the url looks ok, and visitors can even memorize it, but for a normal user to remember a page like which have a lot of query strings and much number or IDs.

Okay Okay, so how to do it on classic ASP.

Actually there are two ways to do url-remapping or rewriting …

Method number one is very simple and very useful if you want to map urls to static pages, and this is would work also for sub-domains, i.e ahmed.she7ata.com, is actually mapped to sub-folder called ahmed underneath the domain name she7ata.com, also for sitemap.xml file, you can generate dynamic sitemap.xml by mapping this xml file to an ASP page which generate this file.

Method number two is a bit complicated and it is very useful if you want to dynamically map pages, i.e blog article pages or categories like this on my she7ata’sBlogs.

Finally, the two methods are based on your custom error page, yes, this is the key, you will need to customize your 404 error page and change it to error.asp for example.
Most of web hosts will give you this option through your CP a.k.a Control Panel, if you do not have this option use the default 404 error page and redirect it to your asp-page any way.

Now to the implementation .

A ve