I want to redirect all these kind of requests
http://www.example.com/2013/01/my-sample-post/feed
or
http://www.example.com/2013/01/my-sample-post/feed/
to
http://www.example.com/2013/01/my-sample-post/
I am using sinatra and rack--rewrite gem.
rewrite %r{/*/feed?}, '/$1' // not working..
You missed a dot in the regex. You also need a capture group with ()
around the wildcard, so it should be (.*)
between the slashes. Iguess you are also missing a slash at the end. This should work:
rewrite %r{/(.*)/feed/?}, '/$1'