Michael
Michael

Reputation: 307

Looking for some guidance on rewriting URL's using PHP and/or htaccess

I want rewrite the URL using PHP and/or .htaccess for when a user goes to http://mysite.com/profile they are acctually accessing http://mysite.com/index.php?page=profile

I'm a litte confused how to do this. Is this practice a good idea?

Upvotes: 0

Views: 94

Answers (1)

Abadon
Abadon

Reputation: 287

If mod rewrite is activated this should work in the .htaccess:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?page=$1

Upvotes: 1

Related Questions