Forum Moderators: phranque
It involves editing the .htaccess file so that the apache server wll "rewrite" my urls.
What i have so far is this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([0-9]+)$ gamepage.php?num=$1
...And what this does is when you go to /1 , the URL bar says /1, but it is actually showing the page gamepage.php?num=1
same with /2 and so forth...
But what i wish to happen is when you go to gamepage.php?num=1 (type it in and press enter), it changes the URL in the bar to /1, even though its still showing gamepage.php?num=1
Thanks!
Options +FollowSymLinks
RewriteEngine on
#
# Externally redirect direct client requests (only) for dynamic URLs to corresponding static URLs
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /gamepage\.php\?num=([0-9]+)\ HTTP/
RewriteRule ^gamepage\.php$ http://www.example.com/%1? [R=301,L]
#
# Internally rewrite static URLs to gamepage script
RewriteRule ^([0-9]+)$ gamepage.php?num=$1 [L]
GET /gamepage.php?num=3 HTTP/1.1
Jim
[edited by: jdMorgan at 11:16 pm (utc) on Aug. 14, 2009]
Now you need to add a separate 'redirect' as well. Use another RewriteRule for that, this time using the [R=301,L] flags.
This topic comes up almost every day so there is a LOT of prior example code, as well as pointers from the forum charter.
jd replied while I was still typing. You got a good answer.