Reputation: 21
When I upload images to my website, their links look like this:
https://mywebsite.com/photo/9/ etc.. only the number changes
I want to rewrite it to be query string, like this:
https://mywebsite.com/p?id=9 etc..
This is what I tried to do, but it doesn't work:
RewriteRule ^/photo/([0-9]+) /p?id=$1
Upvotes: 2
Views: 91
Reputation: 4897
Try using this:
RewriteEngine On
RewriteRule ^photo/([^/]*)$ /p?id=$1 [L]
Upvotes: 1
Reputation: 41249
Remove the leading slash from RewriteRule's pattern,try :
RewriteRule ^photo/([0-9]+)/?$ /p?id=$1 [L]
Upvotes: 0