BarryWalsh
BarryWalsh

Reputation: 1340

Adding trailing slash to specific URL pattern and redirecting the resulting URLs

This is kind of a complicated one to explain but here we go:

I'm trying to work out getting my escaped fragment URLs to work properly. They do work with a traling / but they don't without. My URLs deafult to ones without a trailing / and my app set up won't allow them so I think the only option is to redirect the initial URL with the exact patter to add the trailing /.

So what I'd like to do is redirect:

http://domain.com/?_escaped_fragment_=bike/87/Basso+Loto+105+2013 to http://domain.com/?_escaped_fragment_=bike/87/Basso+Loto+105+2013/ and then that gets redirected to: http://domain.com/bike/87/Basso+Loto+105+2013/

I hope that makes sense.

Thanks!

Upvotes: 1

Views: 98

Answers (1)

anubhava
anubhava

Reputation: 785196

It can be done in one step like:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+\?_escaped_fragment_=([^\s&]+) [NC]
RewriteRule ^ /%1/? [R=302,L,NE]

Upvotes: 0

Related Questions