Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add post

Add question

You must login to ask a question.

Login

Register Now

Цель сайта совместная помощь друг другу, если вы желаете скачивать ресурсы и ничего при этом не делать, вам нужно оплатить Подписку Другой вариант активно помогать другим участникам

Правильный htaccess opencart

Правильный htaccess opencart

Правильный htaccess opencart или оптимальный htaccess.

В интернете найдете кучу примеров, все зависит от хостинга, для нас это был оптимальный вариант

#dnwr_host cdn1.opencart.im cdn2.opencart.im

# Prevent Directoy listing
Options All -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
    Order deny,allow
    Deny from all
</FilesMatch>
# http://www.feofan.net
# SEO URL Settings
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
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]

# Add "gzip Encoding" to already gzipped files
AddType text/css .css .cssgz
AddType text/javascript .js .jsgz
AddEncoding x-gzip .cssgz .jsgz

# Enable Gzip into use mod_gzip.c
<IfModule mod_gzip.c>
    mod_gzip_on         Yes
    mod_gzip_dechunk    Yes
    mod_gzip_item_include file      \.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include mime      ^text\.*
    mod_gzip_item_include mime      ^application/x-javascript.*
    mod_gzip_item_include mime      ^application/x-font-woff.*
    mod_gzip_item_exclude mime      ^image\.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>

# Disable access to php ettor log file
<Files php_error.log>
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

# Cache-Control
<IfModule mod_headers.c>
    Header unset Last-Modified
# 120 days
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|cssgz|jsgz)$">
    Header set Cache-Control "max-age=7776000, public"
    </FilesMatch>
# 120 days + Append Accept Encoding
    <FilesMatch "\.(css|js|cssgz|jsgz)$">
    Header set Cache-Control "max-age=7776000, public"
    Header append Vary: Accept-Encoding
    </FilesMatch>   
# 120 days
    <FilesMatch "\.(xml|txt)$">
    Header set Cache-Control "max-age=7776000, public, must-revalidate"
    </FilesMatch>
# 120 days
    <FilesMatch "\.(html|htm|php)$">
        Header set Cache-Control "max-age=7776000, private, must-revalidate"
    </FilesMatch>
# Compatible with old browsers
    <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
        Header unset X-UA-Compatible
    </FilesMatch>
</IfModule>

# Optimization for Browser Caching 
FileETag MTime Size
<IfModule mod_expires.c>
    ExpiresActive on
    <filesmatch ".(jpg|jpeg|gif|png|ico|css|js|cssgz|jsgz)$">
        ExpiresDefault "access plus 1 year"
    </filesmatch>
    ExpiresDefault "access 7 days"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType text/html "access plus 7 day"
    ExpiresByType text/x-javascript "access 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresByType application/x-shockwave-flash "access 1 year"
</IfModule>

#Compatible with old browsers
<IfModule mod_setenvif.c>
    BrowserMatch "MSIE" force-no-vary
    BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

#max_execution_time это максимальное время работы скрипта, поставил побольше, чтобы сервер не вырубал работающий скрипт.
php_value max_execution_time 200

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
[button size=”small” color=”blue” style=”none” new_window=”false” link=”http://www.feofan.net/wp-content/uploads/2014/11/htaccess_www.feofan.net_.zip”]Готовый .htaccess[/su_button]
Избранное (0)
ClosePlease login

No account yet? Register

About Grek

Хорошее начало — не мелочь, хотя и начинается с мелочи По вопросам подписки / рекламе, пишите в личку https://t.me/trafimmamedov или на почту [email protected]

Follow Me

Comments ( 6 )

  1. Internal Server Error

  2. 500 страница после установки

  3. php_value max_execution_time 200 эта строчка дает ошибку

  4. Для тех, у кого 500 ошибка – убирайте блоки по одному. Скорей всего проблема в блоке с Gzip сжатием.
    php_value max_execution_time 200 – вполне возможно, что она.

    • Конфиг, кстати, мой. делал для себя рад, что пригодился.

  5. Спасибо большое. Я свой файл уже завертел так, что сам запутался”

  6. Я так и не понял работает или нет? Чем хороша такая настройка?

Leave a reply