htaccess mod rewrite's condition

0 replies
Hello,

I am working on SEF URLs, but since my knowledge of regex is far too short, I came up with a situation where I am not able to find a solution on my own.

Code:
RewriteCond %{REQUEST_URI} .([^/])*.html$ [NC]
RewriteRule ^(.*).html$        index.php?page=$1 [L,QSA]
In words, my rewrite condition would be like: match everything, that don't have slash sign before ".html". The problem is that this rewrites me everything!
For example: mydomain.com/page.html would give $_GET['page'] = 'page' and mydomain.com/pa/ge.html would give $_GET['page'] = 'pa/ge'.

Maybe someone would be able to edit my regex and explain what I am doing wrong.

Thank you!
#condition #htaccess #mod #rewrite

Trending Topics