Reputation: 12831
I want to rewrite an url from example.php?id=123 to example-123-hello-world
(where "hello-world" is some fake text)
I tried this:
RewriteRule ^example-(.*)-(.*)$ /example.php?id=$1
it works only if there are no "-" in hello world:
example-123-helloworld
Any ideas how to do this? thanks a lot! :)
Upvotes: 0
Views: 69
Reputation: 49867
here's what you need to use:
RewriteEngine On
RewriteBase /
RewriteRule ^example\-([0-9]+)\-(.*)/?$ example.php?id=$1 [NC,QSA,L]
Upvotes: 4
Reputation: 2898
Try this:
RewriteRule ^example-(.*?)-(.*)$ /example.php?id=$1
Upvotes: 1