Page 2 of 2

Re: Pretty urls (remove file extension, fake folders)

Posted: Thu Oct 20, 2016 4:17 am
by Lysianthus
Another trick I would suggest is to simply catch any character that is not a forward slash, instead of having to declare the characters manually (0-9a-zA-Z), so:

Code: Select all

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ $1.php?cat=$2&page=$3 [L]
The ^ means "not", so [^/] means "anything that is NOT /". :ok:

Re: Pretty urls (remove file extension, fake folders)

Posted: Thu Oct 20, 2016 10:18 am
by Masao
Oh yes, that is a very good point. Catching all would be better for a "fits all" approach. I just personally like small whitelists over blacklists for paranoid security reasons.