Reputation: 31
I'm trying to rewrite $_GET parameters via .htaccess. I've tried several examples, but with no love whatsoever. Basically what I want is the following:
This url:
domain.com/news/message.php?item=12
should become:
domain.com/news/item/12
This is my current .htaccess file which only yet hides the .php extension:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Thanks in advance!
Upvotes: 0
Views: 103
Reputation: 24448
If you are using the news directory you could state your condition in the rewriterule.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news/item/(.*) /news/message.php?item=$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Upvotes: 2