Here is my current mod_rewrite code:
- Code: Select all
RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^level2=([^&]+)(?:&level3=([^&]+)(?:&level4=([^&]+)(?:&level5=([^&]+))?)?)?(&.*)?$ [NC]
RewriteRule ^(index\.php)?$ /%1/%2/%3/%4/? [R=301,L]
right now if i go to:
/index.php?level2=mypage
i get redirected to:
/mypage////
I'm just trying to clean up the 'extra' //// at the end of a url when there is no level3, level4, level5 type of deal.
Not sure how this can be handled without repeating rules. Any help would be appreciated!
Thanks.