Forum Moderators: phranque
http://example.com/my-blog-post/)
How can I rewrite this to take out the parenthesis when parentheses are special characters used in regular expressions? Everything I've tried results in a 500 error.
[webmasterworld.com...]
So, using RedirectMatch or RewriteRule -- both of which use regular expressions, you do something like:
RedirectMatch 301 ^/my-URL-her[b]e\)$[/b] http://www.example.com/my-URL-here
In fact, there are so many characters that *could* occur, that it might be easier to simply redirect any URL that ends with *anything* other than a letter, number, or slash...
RewriteRule ^(.+)[^/0-9a-z]$ http://www.example.com/$1 [NC,R=301,L]
RewriteRule ^([0-9a-z]([/0-9a-z._\-]*[0-9a-z])?)[^/0-9a-z]+$ http://www.example.com/$1 [NC,R=301,L]