Hello Guys, i have This URL http://website.com/ringtones.php?id=12&name=funny-ringtones I want URL like this http://website.com/12-funny-ringtones.html i have done this work with the help of .htaccess file like this Options +FollowSymLinks RewriteEngine on RewriteRule (.*)-(.*).html ringtones.php?id=$1&name=$2 but when i add another url in same condition and same .htaccess file like this RewriteRule (.*)-(.*).html games.php?id=$1&name=$2 then both are not working properly and showing php errors in webpage Anyone help me that how can i do this ? please reply me Thanks
MAYBE, because of conflict? RewriteRule (.*)-(.*).html ringtones.php?id=$1&name=$2 RewriteRule (.*)-(.*).html games.php?id=$1&name=$2 Code (markup): that means 12-funny-ringtones.htm can be ringtones.php?id=12&name=funny-ringtones OR games.php?id=12&name=funny-ringtones. If that's the problem, then you can try to add a prefix to the new url. example: RewriteRule ringtones-(.*)-(.*).html ringtones.php?id=$1&name=$2 RewriteRule games-(.*)-(.*).html games.php?id=$1&name=$2 Code (markup):
Hello djzmo, Thanks for your reply But i saw direct link in many websites like this http://website.com/12-funny-ringtones.html so how it is working ? it is any chances to rewrite url like this ?
Yes. But logically, the code you used in the htaccess is invalid. IMO, that's the reason. You have to use two different representation, or the webserver will get confused on what the url will be rewritten to. It's something like this: - Someone visited http://www.website.com/12-funny-ringtones.html RewriteRule (.*)-(.*).html ringtones.php?id=$1&name=$2 Code (markup): - .htaccess told the webserver to rewrite the url from http://www.website.com/12-funny-ringtones.html to http://www.website.com/ringtones.php?id=12&name=funny-ringtones. RewriteRule (.*)-(.*).html games.php?id=$1&name=$2 Code (markup): - .htaccess told the webserver AGAIN to rewrite the url from http://www.website.com/12-funny-ringtones.html to http://www.website.com/games.php?id=12&name=funny-ringtones. So you will have to change the (.*)-(.*).html and give it an unique name. For example, ringtones-(.*)-(.*).html for ringtones.php?id=&name= and games-(.*)-(.*).html for games.php?id=&name=.
Sorry, i dont understand wht u are talking about but if you want Fixed 'ringtones' and 'games' to be variable then try this: RewriteRule (.*)-(.*)-(.*).html $1.php?id=$2&name=$3 Code (markup): It means that if you enter games-01-wohoo.html will be actually games.php?id=01&name=wohoo and if you enter ringtones-01-funny+ringtone.html , will be actually ringtones.php?id=01&name=funny+ringtone hope this is what you are looking for. Thanks