vinpkl Posted December 7, 2008 Share Posted December 7, 2008 hi all i want to rewrite or hide url in php xampp. i have url like http://localhost/vineet/products.php?dealer_id=10&category_id=1 i want to change it to http://localhost/vineet/products when it shows in address bar vineet Quote Link to comment Share on other sites More sharing options...
gevans Posted December 7, 2008 Share Posted December 7, 2008 You'll need to use a .htaccess file. Have you ever used one before? It will require a mod_rewrite Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 7, 2008 Author Share Posted December 7, 2008 You'll need to use a .htaccess file. Have you ever used one before? It will require a mod_rewrite hi gevans yes i know it will be done by creating .htaccess file in vineet folder that is in my htdocs. but i dont know what to write in it. and i have already uncommented mod-rewrite in apache httpd.conf vineet Quote Link to comment Share on other sites More sharing options...
gevans Posted December 7, 2008 Share Posted December 7, 2008 I think this should work for you; RewriteEngine on RewriteRule ^products.php?/([a-zA-Z0-9_=\&]+)$ products [L] Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 7, 2008 Author Share Posted December 7, 2008 I think this should work for you; RewriteEngine on RewriteRule ^products.php?/([a-zA-Z0-9_=\&]+)$ products [L] hi gevans i used ur code in my htaccess file that i have in vineet folder. then i stoped the apache and restart it. but it still giving me the complete url with http://localhost/vineet/products.php?dealer_id=9&category_id=1 and if i write localhost/vineet/products in the adress bar it gives me error 404 object not found. do i need to do any other settings. vineet Quote Link to comment Share on other sites More sharing options...
gevans Posted December 7, 2008 Share Posted December 7, 2008 I haven't used a htaccess file for a while, I may have had my syntax a bit wrong, let me check over it Quote Link to comment Share on other sites More sharing options...
premiso Posted December 7, 2008 Share Posted December 7, 2008 You are in luck! Now that you know it is the mod_rewrite, a little googling pulls up: http://www.webmastertips.us/tutorials/mod_rewrite.htm and all results http://www.google.com/search?hl=en&q=mod_rewrite+htaccess&btnG=Search I would suggest doing some reading to get it exactly how you want it, just as the old saying goes, "You can feed a man for a day by giving him a fish, or feed a man for life by teaching him how to fish." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.