RewriteEngine On # Well since the second rewritecond is only looking for # for html files in the request, you don't need the first # rewritecond and so it's commented. If you wanted to grab # everything, then you'd need to uncomment the first # rewritecond so you don't infinite loop on the redirection. #RewriteCond %{REQUEST_URI} !somescript.php RewriteCond %{REQUEST_URI} ^(.*?/)*(.*\.html)$ RewriteRule ^ /somescript.php?page=%1 [L,R=301]