RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# For Products page Third Level
RewriteRule    ^products/([0-9a-zA-Z-]+).html$	products.php?mid=$1         [QSA,NC,L]
RewriteRule    ^products/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+).html$	products.php?mid=$1&sid=$2         [QSA,NC,L]
RewriteRule    ^products/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+).html$	products.php?mid=$1&sid=$2&cid=$3         [QSA,NC,L]

RewriteRule    ^products/([0-9a-zA-Z-]+)/page/([0-9]+).html$	products.php?mid=$1&cur=$2         [QSA,NC,L]
RewriteRule    ^products/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/page/([0-9]+).html$	products.php?mid=$1&sid=$2&cur=$3         [QSA,NC,L]
RewriteRule    ^products/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/page/([0-9]+).html$	products.php?mid=$1&sid=$2&cid=$3&cur=$4         [QSA,NC,L]

# For Large page Third Level
RewriteRule    ^product/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+).html$	detail.php?mid=$1&pid=$2         [QSA,NC,L]
RewriteRule    ^product/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+).html$	detail.php?mid=$1&sid=$2&pid=$3         [QSA,NC,L]
RewriteRule    ^product/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+)/([0-9-]+).html$	detail.php?mid=$1&sid=$2&cid=$3&pid=$4         [QSA,NC,L]

# For CMS page
RewriteRule    ^page/([0-9a-zA-Z-]+).html$	                       	pages.php?id=$1 	        [QSA,NC,L]

# For Categories page Third Level
RewriteRule    ^categories.html?$	                                categories.php 	                [QSA,NC,L]
RewriteRule    ^categories/([0-9a-zA-Z-]+).html$	                sub_categories.php?mid=$1         [QSA,NC,L]
RewriteRule    ^categories/([0-9a-zA-Z-]+)/([0-9a-zA-Z-]+).html$	third_categories.php?mid=$1&sid=$2   [QSA,NC,L]

RewriteRule    ^products.html?$	                                    products.php 	                [QSA,NC,L]
RewriteRule    ^products/page/([0-9]+).html$	                    products.php?cur=$1         [QSA,NC,L]

RewriteRule    ^home.html?$	                                        index.php 	                [QSA,NC,L]
RewriteRule    ^basket.html?$	                                    basket.php 	                [QSA,NC,L]
RewriteRule    ^quotation.html?$	                                quote.php 	                [QSA,NC,L]
RewriteRule    ^search.html?$	                                    search.php 	                [QSA,NC,L]
RewriteRule    ^contact.html?$	                                    contact.php 	            [QSA,NC,L]
RewriteRule    ^about.html?$	                                    about.php 	                [QSA,NC,L]
RewriteRule    ^sitemap.html?$	                                    sitemap.php 	            [QSA,NC,L]
RewriteRule    ^categories.html?$	                                categories.php 	            [QSA,NC,L]
RewriteRule    ^basket.html?$	                                	basket.php 	            [QSA,NC,L]
RewriteRule    ^production.html?$	                                production.php 	            [QSA,NC,L]
RewriteRule    ^privacy_policy.html?$	                            privacy_policy.php 	            [QSA,NC,L]

RewriteRule    ^catalouge.html?$	                                catalouge.php 	            [QSA,NC,L]
RewriteRule    ^factory_view.html?$	                                factory_view.php 	            [QSA,NC,L]
RewriteRule    ^size.html?$	                                		size.php 	            [QSA,NC,L]
RewriteRule    ^certification.html?$	                           	certification.php 	            [QSA,NC,L]
RewriteRule    ^membership.html?$	                                membership.php 	            [QSA,NC,L]
RewriteRule    ^fairs_exhibition.html?$	                            fairs_exhibition.php 	            [QSA,NC,L]
RewriteRule    ^global_presence.html?$	                            global_presence.php 	            [QSA,NC,L]
RewriteRule    ^customer_service.html?$	                            customer_service.php 	            [QSA,NC,L]
RewriteRule    ^private_policy.html?$	                            private_policy.php 	            [QSA,NC,L]
RewriteRule    ^order_process.html?$	                            order_process.php 	            [QSA,NC,L]