In my .htaccess I have a rewrite rule which reads $_GET
values from a clean looking url. For one of the sections in the url I'm allowing all characters (.*)
to be part of the var. The only issue with this is when I follow a link to my site from twitter, it includes a final '/ ' in the url.
RewriteRule ^advertise/([A-Za-z0-9]+)/(.*)/?$ advertise/?a=b&content=$1&content_att=$2 [L]
www.mysite.com/advertise/content/content_att
works just fine
- butwww.mysite.com/advertise/content/content_att/
trys including the '/ ' as part of the content_att
var. What would the expression be to only exclude slashes? (or any other mod_rewrite convention to accomplish this)
[^/]
will include any character except /
[^/]*
will include any number of characters that are not /
In action should look like this:
RewriteRule ^advertise/([A-Za-z0-9]+)/([^/]+)/?$ advertise/?a=b&content=$1&content_att=$2 [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With