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 Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/ 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 Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708471 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 Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708475 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] Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708479 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 Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708482 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 Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708484 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." Link to comment https://forums.phpfreaks.com/topic/135908-rewrite-or-hide-url-in-php-xampp/#findComment-708538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.