RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(?:(?!website).).*\.(?:(?!php).)+$ cms/website/$0 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} .* RewriteCond %{QUERY_STRING} .* [NC] RewriteRule .*\.php cms/index.php?request=$0&%{QUERY_STRING} [L] RewriteRule ^[^./]*(\/[^./]*)*$ cms/index.php?dirs=$0 [L]