RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_URI} product[\d]{1,4}\.html
RewriteRule product([\d]{1,4})\.html /product/$1 [R=301,L]
RewriteRule ^([0-9a-zA-Z]+).html$ / [QSA,NE,L]
ErrorDocument 404 404.html
#shop
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^shop/(repo_themes|js|3rdparty|images_common|products_pictures|images|themes|css)/(.*)$ published/SC/html/scripts/$1/$2?frontend=1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^shop/(imgval.php|wbs_messageserserver.php) published/SC/html/scripts/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(repo_themes|js|3rdparty|images_common|products_pictures|images|themes|css)/(.*)$ published/SC/html/scripts/$1/$2?frontend=1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(imgval.php|wbs_messageserserver.php|get_file.php) published/SC/html/scripts/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^shop(.*) published/SC/html/scripts/$1&frontend=1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^photos/(album|view)/(.*) photos/index.php?q=$1/$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^photos/fullsize/(.*)/(.*) photos/getfullsize.php?filename=$1&hash=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^photos/(.+)$ photos/index.php?q=$1 [L,QSA]
#common
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^login/(.*) login/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^installer/(.*) installer/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^published/$ published/index.php [L]