DirectoryIndex index.php index.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_USER_AGENT} Android|iPhone|iPod|Mobile|webOS [NC]
RewriteRule ^$ mobile/index.html [L]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ index.html [L]
RewriteCond %{THE_REQUEST} \s/+(.*?)(?:\.html)[\s?] [NC]
RewriteRule ^ /%1 [R=301,L]
RewriteCond %{THE_REQUEST} \s/+(.*?)/index\.html[\s?] [NC]
RewriteRule ^ /%1/ [R=301,L]
RewriteCond %{REQUEST_URI} ^/products/?$ [NC]
RewriteCond %{HTTP_USER_AGENT} !(Android|iPhone|iPod|Mobile|webOS) [NC]
RewriteRule ^products/?$ products/index.html [L]
RewriteCond %{REQUEST_URI} ^/products/?$ [NC]
RewriteCond %{HTTP_USER_AGENT} Android|iPhone|iPod|Mobile|webOS [NC]
RewriteRule ^products/?$ products/indexm.html [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_USER_AGENT} !(Android|iPhone|iPod|Mobile|webOS) [NC]
RewriteRule ^(.+?)/?$ $1/index.html [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_USER_AGENT} Android|iPhone|iPod|Mobile|webOS [NC]
RewriteCond %{REQUEST_FILENAME}/indexm.html -f
RewriteRule ^(.+?)/?$ $1/indexm.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1m.html -f
RewriteRule ^(.+?)/?$ $1m.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [L]