# OpenCart SEO URLs — shared by multistore
# Kozmix:    http://localhost/kozmix/   (subdir)
# Bluehoop:  http://bluehoop.local/     (vhost DocumentRoot = this folder)
# Kleopatra: http://kleopatra.local/    (vhost DocumentRoot = this folder)
#            http://localhost/kleopatra/ (symlink)
# O'bora:    http://obora.local/        (vhost DocumentRoot = this folder)
#            http://localhost/obora/    (symlink)

Options +FollowSymlinks
Options -Indexes

<FilesMatch "(?i)((\.tpl|\.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
</FilesMatch>

RewriteEngine On

# --- Bluehoop / Kleopatra / O'bora (vhost DocumentRoot = this folder) ---
RewriteCond %{HTTP_HOST} ^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteRule ^sitemap\.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteCond %{HTTP_HOST} ^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteRule ^googlebase\.xml$ index.php?route=extension/feed/google_base [L]
RewriteCond %{HTTP_HOST} ^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{HTTP_HOST} ^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

# --- Kleopatra via http://localhost/kleopatra/ ---
RewriteCond %{REQUEST_URI} ^/kleopatra/ [NC]
RewriteRule ^sitemap\.xml$ /kleopatra/index.php?route=extension/feed/google_sitemap [L]
RewriteCond %{REQUEST_URI} ^/kleopatra/ [NC]
RewriteRule ^googlebase\.xml$ /kleopatra/index.php?route=extension/feed/google_base [L]
RewriteCond %{REQUEST_URI} ^/kleopatra/ [NC]
RewriteRule ^system/storage/(.*) /kleopatra/index.php?route=error/not_found [L]
RewriteCond %{REQUEST_URI} ^/kleopatra/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css)
RewriteRule ^([^?]*) /kleopatra/index.php?_route_=$1 [L,QSA]

# --- O'bora via http://localhost/obora/ ---
RewriteCond %{REQUEST_URI} ^/obora/ [NC]
RewriteRule ^sitemap\.xml$ /obora/index.php?route=extension/feed/google_sitemap [L]
RewriteCond %{REQUEST_URI} ^/obora/ [NC]
RewriteRule ^googlebase\.xml$ /obora/index.php?route=extension/feed/google_base [L]
RewriteCond %{REQUEST_URI} ^/obora/ [NC]
RewriteRule ^system/storage/(.*) /obora/index.php?route=error/not_found [L]
RewriteCond %{REQUEST_URI} ^/obora/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css)
RewriteRule ^([^?]*) /obora/index.php?_route_=$1 [L,QSA]

# --- Kozmix / other hosts served under /kozmix/ ---
RewriteCond %{HTTP_HOST} !^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteCond %{REQUEST_URI} !^/(kleopatra|obora)/ [NC]
RewriteRule ^sitemap\.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteCond %{HTTP_HOST} !^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteRule ^googlebase\.xml$ index.php?route=extension/feed/google_base [L]
RewriteCond %{HTTP_HOST} !^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{HTTP_HOST} !^(bluehoop|kleopatra|obora)\.local$ [NC]
RewriteCond %{REQUEST_URI} !^/(kleopatra|obora)/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|webp|js|css)
RewriteRule ^([^?]*) /kozmix/index.php?_route_=$1 [L,QSA]
