Post by maple-Lee » Wed Oct 16, 2019 5:48 pm

The following is my htaccess file, I will appreciate that if someone can show me which code is unnecessary or duplicate, or will it be some code have to put on top?

# STARTNITRO
Header unset ETag
Header unset Last-Modified
FileETag None

#CSS JS XML TXT - 1 WEEK
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

#JPG JPEG PNG GIF SWF SVG - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header set Cache-Control "max-age=2592000, public"
ExpiresDefault "access plus 1 month"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
</FilesMatch>

#OTF WOFF TTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv|woff|ttf)$">
Header set Cache-Control "max-age=2592000, public"
ExpiresDefault "access plus 1 month"
</FilesMatch>
AddType image/svg+xml .svg
AddOutputFilterByType DEFLATE image/svg+xml
AddType application/x-font-woff .woff
AddType application/x-font-woff .woff2
AddOutputFilterByType DEFLATE application/x-font-woff
AddType application/x-font-ttf .ttf
AddOutputFilterByType DEFLATE application/x-font-ttf
AddType application/x-font-eot .eot
AddOutputFilterByType DEFLATE application/x-font-eot]

RewriteEngine On
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?(assets).+)\.css$ assets/serveFile.php?t=css&l=4&p=$1&c=604800 [NC,L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?(assets).+)\.js$ assets/serveFile.php?t=js&l=4&p=$1&c=604800 [NC,L]
# ENDNITRO

RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteRule ^sitemap_index.xml$ index.php?route=extension/hbseo/sitemap [L,QSA]
RewriteRule ^sitemaps/([^?]*)/product_sitemap_([0-9]+).xml$ index.php?route=extension/hbseo/sitemap/products&language=$1&page=$2 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/product_tags_sitemap_([0-9]+).xml$ index.php?route=extension/hbseo/sitemap/product_tags&language=$1&page=$2 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/category_sitemap.xml$ index.php?route=extension/hbseo/sitemap/category&language=$1 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/brand_sitemap.xml$ index.php?route=extension/hbseo/sitemap/brand&language=$1 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/information_sitemap.xml$ index.php?route=extension/hbseo/sitemap/information&language=$1 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/category_to_product_sitemap.xml$ index.php?route=extension/hbseo/sitemap/category_to_product&language=$1 [L,QSA]
RewriteRule ^sitemaps/([^?]*)/brand_to_product_sitemap.xml$ index.php?route=extension/hbseo/sitemap/brand_to_product&language=$1 [L,QSA]
RewriteRule ^sitemaps/misc_sitemap.xml$ index.php?route=extension/hbseo/sitemap/misc [L,QSA]
RewriteRule ^sitemaps/([^?]*)/journalblog_sitemap.xml$ index.php?route=extension/hbseo/sitemap/journalblog&language=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTP_HOST} ^mydomain.com
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]


# STARTCOOKIENITRO
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header unset Cookie
Header unset Set-Cookie
</FilesMatch>
# ENDCOOKIENITRO
# STARTNITRO
ExpiresActive On

#CSS JS XML TXT - 1 WEEK
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, public"
ExpiresDefault "access plus 1 week"
</FilesMatch>

#JPG JPEG PNG GIF SWF SVG - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header set Cache-Control "max-age=2678400, public"
ExpiresDefault "access plus 1 month"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
</FilesMatch>

#OTF WOFF TTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv|woff|ttf)$">
Header set Cache-Control "max-age=2678400, public"
ExpiresDefault "access plus 1 month"
</FilesMatch>
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directory listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log))”>
Order deny,allow
Deny from all
</FilesMatch>

Header set Strict-Transport-Security "max-age=31536000" env=HTTPS

# SEO URL Settings

## SWITCH COMPRESSION ON
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule>

<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
## END SWITCH COMPRESSION ON


# Set XSS Protection header
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>

<IfModule mod_headers.c>
Header always set X-FRAME-OPTIONS "DENY"
</IfModule>

New member

Posts

Joined
Fri Apr 10, 2015 11:38 pm

Post by IP_CAM » Thu Oct 17, 2019 1:32 am

You're displaying a content out of a paid Extension, 8) ::)
but this one would sure not work:

Code: Select all

RewriteCond %{HTTP_HOST} ^mydomain.com 
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 22 guests