954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

About URL Rewriting...

Im shanti..

I am developing one dynamic site ,
here my product display page is like products.php?prod_id=1
It means the products under first category are displayed..
but i want my url like products/categoryname.html..something like this, with my category name...which will spiderable format..

Please help me to do this...

All helps are much appreciated

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

Hi..
Im also new to this concept... But i think i can try...
All this can be done in the .htaccess file in the root folder of your website...
You can search on mod_rewrite or rewriterule on google to get more tutorials and details...

RewriteEngine On
RewriteRule ^/products/(.*).html$ /products\.php?category_name=$1


Im not sure about the above code... But even i learnt this from a tutorial...

sikka_varun
Junior Poster in Training
94 posts since Dec 2008
Reputation Points: 11
Solved Threads: 12
 

provide some good tutorials...please....

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

url like product.php?prod_id=1 it does not have importance to that URL as search engine sees “?” sign treat it as a url which keeps on changing.
so convert the dynamic URL product.php?prod_id=1 to static url format product-5.html.
So rewrite the url like it display product-1.html but it actually cal product.php?prod_id=1.

so you rewrit url using .htaccess

You can find lots of tutorial on google...like

http://www.freewebmasterhelp.com/tutorials/htaccess/
http://www.easywebtutorials.com/tutorials/htaccess.html
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

thanks amit for your clear explanation....
can you post correct code for the above example , you have specified..
and tel me where to put the .htaccess file,if my products page is in another folder...
thank you for your reply....

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

If you want to use html url instead of the actual url then you have to use third party tool for this. Then you have to made httpd.ini file on the root of your site and keep all the html url in it. But you should first understand the regular expression to use these type of url otherwise your url may not work correctly.

faizurrahman
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 
If you want to use html url instead of the actual url then you have to use third party tool for this. Then you have to made httpd.ini file on the root of your site and keep all the html url in it. But you should first understand the regular expression to use these type of url otherwise your url may not work correctly.


thanks for your reply...
can i make these type of urls with out httpd.ini file...if so tel me how to do that??????

thanks
shanti

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

According to my knowledge shanti you cannot make these type of url without .ini file because these type of url always not work locally. It work only online which is supported by third party tool.
Thanks

faizurrahman
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 
thanks for your reply... can i make these type of urls with out httpd.ini file...if so tel me how to do that??????


You'll probably have to enable mod rewrite by uncommenting a line in the http.conf file located in apache/conf/ folder. You won't be able to mod rewrite without first enabling it.

buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
 

thanks to all for their inputs...

Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
 

I'm looking theese tutorials
http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html
I can't understand the second tutorial, can somebody explain me?
How it take "ipod-nano" , from wich parameter?

ultras1
Newbie Poster
19 posts since Sep 2009
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You