Reputation: 673
I want to type www.mysite.com/page1
in the browser
but I want the server to get this.
www.mysite.com/index.php?page=1
and I want the former address www.mysite.com/page1
to stay persistent in the browser address bar. Is this possible?
I assume it's a mod rewrite but I really have trouble with that file.
Thanks.
Upvotes: 0
Views: 173
Reputation: 785108
Enable mod_rewrite
and .htaccess
through httpd.conf
(if not already enabled) and then put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ /index.php?page=$1 [L,NC,QSA]
Upvotes: 1