开发者

apache mod_rewrite problem for the url

开发者 https://www.devze.com 2023-03-11 00:45 出处:网络
As i am trying to rewrite a url into searc开发者_Python百科h engine friendly but i am not getting the proper form like. for example originally my url will be like this....

As i am trying to rewrite a url into searc开发者_Python百科h engine friendly but i am not getting the proper form like. for example originally my url will be like this....

http://www.playtoongames.com/getscore.php?game_name=MarioVsSonic

The above url i am requesting from the flash game. so while i am requesting this url from flash game the html content comes in wired format like this http://www.playtoongames.com/getscore.php?game_name=MarioVsSonic instead of coming like this.. http://www.playtoongames.com/getscore now i want to make this into this form like...

http://www.playtoongames.com/getscore/MarioVsSonic

For the above thing to happen i have created a .htaccess file and written the code like this...

RewriteRule ^get_name/([^/\.]+)/?$ getscore.php?get_name=$1 [L]

Regards, phphunger


You need to turn the rewrite mode on in .htaccess.

RewriteEngine On
RewriteBase /

And after this define your rewrite rules.


The following rule will do the job to rewrite http://www.playtoongames.com/getscore/MarioVsSonic into http://www.playtoongames.com/getscore.php?game_name=MarioVsSonic

RewriteRule ^getscore/([^/\.]+)/?$ /getscore.php?get_name=$1 [L]

Compare to your rule and see where you have made a mistake.

0

精彩评论

暂无评论...
验证码 换一张
取 消