Redirect in combination with a rewrite condition in htaccess Redirect in combination with a rewrite condition in htaccess apache apache

Redirect in combination with a rewrite condition in htaccess


You need to look at the request line in THE_REQUEST to see what originally has been requested:

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^?\ ]*\?id=21\  [NC]RewriteRule /* /peuterspeelzaal? [R=301,L]RewriteRule ^peuterspeelzaal$ index.php?id=21 [L]


I'm guessing you are rewriting in both directions to ensure that old links are redirected to the new friendly urls?

You could just add a dummy parameter to all your "friendly" rewrites so that they don't match the other rule:

RewriteCond %{query_string} ^id=21$ [NC]RewriteRule /* /peuterspeelzaal? [R=301,L]RewriteRule ^peuterspeelzaal$ index.php?id=21&dummy=1 [L]