Reputation: 3872
I have the following page:
mysite.com/news/index.php?tag=tag&name=name&id=id
I want to rewrite this so that it goes kind of as follows
mysite.com/news/tag/name-id
A full example of this would be.
foobar.com/news/apple/the-new-iphone-5-9001
Also after I rewrite this URL will I still be able to pull data as I would normally for instance:
$_GET['tag'] //would be apple
$_GET['name'] //would be the-new-iphone-5
$_GET['id'] //would be 9001
Upvotes: 1
Views: 2078
Reputation: 72971
Add this to .htaccess in your web root.
RewriteEngine On
RewriteBase /
RewriteRule ^news/([^/]+)/(.+?)-(\d+)/?$ /news/index.php?tag=$1&name=$2&id=$3
Upvotes: 3