Welcome to WebmasterWorld Guest from 22.214.171.124
i am having troubles with the mod_rewrite and hope you gurus can help me :)
I am trying to rewrite an url so the output says "...&platform=Game.com" , but all i get is "Game com" - the dot seems to be lost. This is my current code:
RewriteRule ^games-Game_com.html$ /index.php?module=games&platform=Game\.com [L]
I have tried to escape the dot with a "\" and i've tried it without the backslash - with no luck.
Thank you for your time!
Not a guru, but not escaping a dot in a regexp is wrong, even if in this case, it would not change the behaviour, a dot in a regexp meaning "whatever character", and thus, a dot ;-) On the contrary, you musn't escape the dot in the substitution string.
Then, there is concern about the paths. If you are using a RewriteBase directive before your rewrite rule, it should work better (I guess) :
RewriteRule ^(.*)games-Game_com\.html$ $1/index.php?module=games&platform=Game.com [R,L]
You may refine the RewriteBase directive to fit your needs. If the games-Game_com.html url and the index.php url are in the same directory, you can avoid the .* pattern (I learned here why to avoid it).
RewriteRule ^games-Game_com\.html$ index.php?module=games&platform=Game.com [R,L]
You could also create a .htaccess file in the directory itself, and get rid of the RewriteBase directive.
Let us know if it worked.