Howdy,
I know this's not the first mod_rewrite thread, but I hope I can find the answer here :o

I have a game script running on server and I need to change the dynamic url to SEF.

placed this code:

Options +FollowSymLinks
RewriteEngine on
RewriteRule game/(.*)/(.*)/$ /games/game.php?$1=$2

in the .htaccess file, but it didn't work :mad:

The dynamic url is: http://www.mysite.com/games/game.php?gameid=27
and I want it to look like:

http://www.mysite.com/games/game/27/ or
http://www.mysite.com/games/game/27.html

Is there a way this can be done?

Thanks alot.

Hi PoA
I didn't get a thing!!!!

RewriteEngine on
RewriteRule ^games/game/([^/]+).html$ /games/game.php?gameid=$1 [L]

also make sure that apache has the mod_rewrite module loaded (most webhosts do this), but you can easily check by usign phpinfo() and then scrolling down to apache --> Loaded Modules

also make sure that apache has the mod_rewrite module loaded (most webhosts do this), but you can easily check by usign phpinfo() and then scrolling down to apache --> Loaded Modules

Hi paradox814

Thank you, but please take a look (Ithink I'm going nuts here!)
here's my php info:

Loaded Modules mod_jk, mod_scoreboard, mod_fastcgi, mod_security, mod_gzip, mod_auth_passthrough, mod_log_bytes, mod_bwlimited, mod_php4, mod_frontpage, mod_ssl, mod_setenvif, mod_so, mod_expires, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime, mod_log_config, mod_env, http_core

as you can see the mod_rewrite module is loaded, but when placing :

RewriteEngine on
RewriteRule ^games/game/([^/]+).html$ /games/game.php?gameid=$1 [L]

in the .htaccess file in the same folder where's the script is installed, it won't work ! :sad:

And here's the dynamic url that I want to change:
http://www.site.com/play/game.php?gameid=27

What am I doing wrong here guys :!:

try placing the .htaccess file in the www.site.com folder not in the game folder

you gave a different folder name the second time, so I'm just going to stick with the original of
http://www.site.com/games/game.php?gameid=27
and not
http://www.site.com/play/game.php?gameid=27

if that doesn't work, then try removing the carrot and see what happens:

RewriteEngine on
RewriteRule games/game/([^/]+).html$ /games/game.php?gameid=$1 [L]

but leave it in the www.site.com/ folder

try placing the .htaccess file in the www.site.com folder not in the game folder

you gave a different folder name the second time, so I'm just going to stick with the original of
http://www.site.com/games/game.php?gameid=27
and not
http://www.site.com/play/game.php?gameid=27

if that doesn't work, then try removing the carrot and see what happens:

RewriteEngine on
RewriteRule games/game/([^/]+).html$ /games/game.php?gameid=$1 [L]

but leave it in the www.site.com/ folder

paradox814

Thanks for tying, but the damn thing won't work even when I place the .htaccess code in the site root. :(

And by the way what's the "carrot" ?!

What's the error are you getting?

What's the error are you getting?

Well, there's no error :lol:

It's not working for some reason, the dynamic urls won't change !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.