Learnosity Logo
Learnosity Banner Image

Flexible Friendly URLs for Farcry with Mod rewrite (update 2)

I've previously blogged about using mod rewrite to do friendly URL's. I've just discovered a minor issue with the regex I had been using:

RewriteRule ^/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&$2 [PT,L,QSA]

This will work for all the /go/ urls on the site but it is not specific enough and will also match all urls that begin with /go.

Eg: /googlesitemap.xml will be redirected through the friendly URL handler also.

A minor fix is all that is needed:

RewriteRule ^/go/([^\?]*)(?:\?(.*))? /go.cfm\?path=/go/$1&$2 [PT,L,QSA]

Note the two extra /'s.

Cheers, Mark

Comments