regex for creating pritty urls in htaccess

Go To StackoverFlow.com

0

What is the right regex to

create this url: domain.nl/projecten/scheidingswanden from

http://www.domain.nl/?module=projectencat&action=scheidingswanden

in other words: replace the variable names ?module= and &action= with slashes

but also the other way around because the frontcontroller needs to read the get variables module and action

I don't know if it's only htaccess, but this logic is missing

thanks, Richard

2012-04-04 08:23
by Richard
So your users use URLs with slashes and you would like to rewrite that to ?module.. Or is it the opposite - barsju 2012-04-04 10:58


0

This may help :

RewriteEngine on
RewriteRule ^([a-zA-Z]+)/(.*)/index.html$ index.php?module=projectencat&action=scheidingswanden

[a-zA-Z]+ = requires one or more alphabetic chars
(.*)      = requires one or more any kind of chars
2012-04-04 10:42
by codef0rmer


0

RewriteRule  ^([^/])/([^/])$    ?module=projectencat&action=scheidingswanden  [L]
2012-04-04 10:16
by undone


0

Is this what you are looking for:

RewriteRule  ^([^/]+)/([^/]+)$    ?module=$1&action=$2
2012-04-04 10:56
by barsju
what does cat mean - Richard 2012-04-04 10:59
Well you URL has projecten and the query param is projectencat.. Didn't know what to do with that.. I'll remove it as it is probably not what you want. - barsju 2012-04-04 11:30
Ads