Hello DP members. I need your help. At www.coalgames.com, I have a script named games.php. The $_[GET] components in it is flash (string)> My goal: To set games.php?flash=penguin-panic and turn the url into penguin-panic-flash-game which is really good. Example: www.coalgames.com/games.php?flash=penguin-panic Transformed into: www.coalgames.com/penguin-panic-flash-game I have already set the mod rewrite to this code Options +FollowSymlinks RewriteEngine On RewriteRule ^([^/]*)-flash-game$ /games.php?flash=$1 [L] Code (markup): I have been sucessful so far but the question is how do I make it so that games.php?flash=penguin-panic redirects into penguin-panic-flash-game. I want this because I already have over 400 backlinks on one game of it and I dont want to lose these backlinks (Because some of these are unchangeable like Digg). This would really help in SEO because if you search "penguin panic" , it will yield some iPhone game and some band. If you search "penguin panic flash game", my page isi'nt on there. I really appreciate your help. Thank you. P.s. Actually, if you search "penguin panic flash game", something very funny happens. http://www.google.com/search?hl=en&q=penguin+panic+flash+game *edit nevermind (Google web history LOLOL)
Ok, seems easy enough. RewriteEngine On RewriteRule ^penguin-panic-flash-game /games.php?flash=penguin-panic Code (markup):
Thanks. But the real question is how do i generate from the get because I dont have only one game. For example take games.php?flash=barricades-2 ==> barricades-2-flash-game. Thank you
Your rewrite rule you mentioned in original post looks fine, and as I understood that part is fine. You now want to have other thing around, to have all visits pointed to your old url via games.php?flash=blah-blah to have redirected to new structure which includes mod_rewrite urls... right? Well... I think that might create dead loop, mod rewrite rules will redirect to script url, and script url would then redirect back to rewrite url, and then again... and again, and again... I think that's not a good idea. However... you could do something like this maybe... change the name of your php script? For example from games.php to game.php and then change your .htaccess to look something like this: Options +FollowSymlinks RewriteEngine On RewriteRule ^([^/]*)-flash-game$ /game.php?flash=$1 [L] RewriteRule ^games.php?flash=([^/]*)$ /$1-flash-game [R=301,L] Code (markup): Note that both rule lines are modified to apply to game.php instead of games.php. I haven't tested this code, but it should be working fine.
Thank you very much. I fully understand it now. Ill move games.php into /obscuredirectorydsew9a/e4/gamepage.php Then the old games.php will redirect to blah-blah-flash-game. Thank you very much. Now I get why I could not redirect it. Because it is showing the page that it wants to redirect to itself and do it again and again. Thank you very much.