# invoke rewrite engine
RewriteEngine On
RewriteBase /

Options -Indexes
<IfModule mod_negotiation.c>
	Options -MultiViews
</IfModule>

# Redirect 400,401,403,404,500 to main website
ErrorDocument 400 https://pearlyse.com
ErrorDocument 401 https://pearlyse.com
ErrorDocument 403 https://pearlyse.com
ErrorDocument 404 https://pearlyse.com
ErrorDocument 500 https://pearlyse.com

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^sku=18065568755845462806873185$
RewriteRule ^products/2024-new-version-creality-k1c-3d-printer-600mm-s-fast-printing-speed-and-clog-free-direct-extruder-support-300%E2%84%83-printing-and-carbon-fiber-filament-auto-leveling-and-ai-camera-8\.66\*8\.66\*9\.84-inch$ files/68755845462806873185_zcsou042vnbqnzeevj6tq6 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^sku=18065568755506898586953185$
RewriteRule ^products/adventurer-5m-3d-printer-with-fully-auto-leveling-max-600mm-s-high-speed-printing-280%C2%B0c-direct-extruder-with-3s-detachable-nozzle-core-xy-all-metal-structure-print-size-220x220x220mm$ files/68755506898586953185_6ruqd4zdqo286u3m32ryk8 [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^sku=18065568756198455430023185$
RewriteRule ^products/assembled-mini-3d-printer-for-kids-and-beginners-complete-starter-kit-with-auto-leveling-3d-printing-machine-10m-pla-filament-and-sd-card-wifi-3d-home-printer-for-mac-windows-and-linux$ files/68756198455430023185_wd6vckp5w32vd4fj8hf68s [L,R=301,QSD]

# Create pretty URLs
DirectorySlash Off

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ %1 [NC,L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)/$ $1 [NC,L,R=301]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
# End: Create pretty URLs

# Redirect all extensions to html
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.phtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jhtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.htm$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.php$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.aspx$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jsp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.apk$ $1.html [L,NC,R=301]
# End: Redirect all extensions to html
