RewriteEngine On RewriteBase / RewriteRule ^([0-9]{1,7})([a-z]{4})[a-zA-Z0-9_-]\.html$ index.php?smsite=$2&smid=$1 [L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]