How to write clean URL

Topics: Developer Forum, Project Management Forum, User Forum
Nov 9, 2009 at 11:00 AM
Edited Nov 9, 2009 at 11:03 AM


I am trying to write the redirect URL for my shopping cart but i am lost.Please help me how to write the redirect URL


this is the URL for one of the page in my website

Here price , store, template, template3 are the folders

mainpage = ProductInfo >>>This tell which ASP page is calling .Like its calling.

Cpath=   "It tell the category underwhich the product lies in shopping cart"

PID represents the product ID


Another URl :







Nov 9, 2009 at 11:14 AM

I'm sorry, I don't know what you're trying to do.  I'm clear you want to REDIRECT.  But you didn't say how.  You didn't give any examples.

You need to give examples like this:

A URL request like this:  http://server/5048/tifu/arf/Default.asp?PROD=72739  should be redirected to:  ???????



Nov 9, 2009 at 12:02 PM

Dear Cheeso,

Sorry i was not clear .


Here refers to category ID and PID refers to Product ID

redirect to :



One more query in addition to the above one.

We have hyperlinks in the above page say for example Home || Contactus like that.Do we need to set the rewrite rule for all pages only or we have to change the each and every hyperlink in our coding to the new defined links in rewrite file links.





Nov 9, 2009 at 12:19 PM
Edited Nov 9, 2009 at 12:20 PM

You have a URL that contains Category IDs and Product IDs, and you want to redirect to URLs that employ Category Names and Product Names, is that correct?  In that case your rules will have to contain the mapping between IDs and NAMEs.  Do you understand that?  You will need a different rule for each category, and for each product ID.

And you are sure you want a REDIRECT, and not a REWRITE, yes?  Do you understand the difference between a REDIRECT and a REWRITE?  
If you definitely want a REDIRECt, then I am surprised.   I think it is more likely that you don't know what you are asking for.

If you want a redirect, then... here is how you would do it.  Suppose Category ID 1755 corresponds to the category name "Hammers", and category 6213 corresponds to "Wrenches".   And suppose, within Hammers, product ID 4115 refers to a Claw hammer, while 4116 refers to a Framing hammer.  And within Wrenches, 5117 refers to a Box wrench and 5119 refers to an adjustable wrench.  These rules would do the mapping. 

# Map Category 6213 to Wrenches
RewriteRule  ^/price/store/template/template3/Default.asp?mainPage=PRODUCT_INFO&cPath=6213&P_ID=([0-9]+)   /price/Wrenches/$1 

#Map Category 1755 to Hammers
RewriteRule  ^/price/store/template/template3/Default.asp?mainPage=PRODUCT_INFO&cPath=6214&P_ID=([0-9]+)   /price/Hammers/$1 

# Map the product IDs to well-known names 
RedirectRule  ^/price/([^\]+)/4115   http://server/price/$1/Claw 
RedirectRule  ^/price/([^\]+)/4116   http://server/price/$1/Framing
RedirectRule  ^/price/([^\]+)/5117  http://server/price/$1/Box
RedirectRule  ^/price/([^\]+)/5119  http://server/price/$1/Adjustable

Notice that you need a single rule for each mapping of ID to name. The initial round of mappings will do the categories. These can be rewrites. The final round of mapping takes care of the products. This must be a redirect.

But, I don't think that makes sense. It will do what you described, but I have never seen anyone ask for that particular thing. I'm surprised that you are asking for this.

Nov 9, 2009 at 12:30 PM

Dear Cheeso,

Thanks for your help.I would like to rewrite the URL.

I am trying to write SEO friendly clean SEO Friendly URL in place of those big URL's.



Nov 9, 2009 at 12:50 PM

I suggest you read the documentation on IIRF.  Especially worthwhile for you will be the section comparing redirect with rewrite.  Also, you should read some of the examples.  After doing some reading, I suggest you try out some rules with the TestDriver tool.  That, too, is documented.

Good luck!



Nov 10, 2009 at 2:29 AM

Dear Cheeso,

Thanks for your help.

I have read the documentation and Installed the IIRF properly.Now i have few queries.I tried few sample with redirection and they are wrking.I put the clean URL in address bar and result shows data from the original URL.

My Problems: I am still bit confused abt the rewrite and redirect.I don't expect you to teach and guide me for the same.Please pardon me if i write confusing sometime.Please feel free to guide me if i am wrong in approach for SEO friendly URL's.

My Goal is to create SEO friendly URL's for my shopping cart. What I want when page gets parsed in browser it should show the Parsed links as SEO friendly not the original one.

As in my sample when i type  URL in address bar it didn't gets changed to clean URL. When i type the clean URL in address bar it shows the data from original URL.

In my shopping cart there are lot of Hyperlinks to other pages.They are also in Dynamic in nature not the static one.How can i set those static hyperlinks to clean URL using IIRF without making substantial changes in my cart.


Nov 10, 2009 at 3:35 AM
Edited Nov 10, 2009 at 3:37 AM

Hey Sunny,

I understand.  Normally when people have non-SEO URLs that are generated by the application, they take this approach:

  1. REDIRECT the non-SEO URL to an SEO URL,
  2. REWRITE the SEO URL to the original dynamic URL

Before you are able to do this, you must understand the distinction between redirect and rewrite.  I've written it into the documentation, and there are other sources in the internet that can explain it.  I won't repeat that explanation here, but I will summarize.  REDIRECT involves a communication between the server and browser, an HTTP response.  The browser changes its address bar with the target of the redirect.  therefore, if I visit http://server/cart.php?p1=a&p2=b , and the server redirects , then the URL in the address bar may be http://server/cart/a/b .

At that point the browser requests the clean (SEO) URL.  The server may then perform a REWRITE, which is a server-side action.  The browser is not aware of URL rewrite.  There is no communication between server and browser in a rewrite, and there is no update of the browser address bar .   The server performs a rewrite in order to map clean URLs to the maybe messy, dynamic, querystring parameterzed URLs that are required by the web app platform. Therefore with rewrite, the clean URL like http://server/cart/a/b is mapped (Server side only) to visit http://server/cart.php?p1=a&p2=b , which is the original URL.  This original URL is then handled by the original cart.php page, and the response is delivered back to the browser.   

From the user's perspective, it's a clean SEO URL.  From the server's perspective, it uses a parameterized querystring URL.

I suggest you try this out with a test application to get the idea.  You'll see how it works.