apache_conf ocStrore 1.5 htaccess

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf ocStrore 1.5 htaccess相关的知识,希望对你有一定的参考价值。

# 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 Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
# Apache < 2.3
<IfModule !mod_authz_core.c>
  Order allow,deny
  Deny from all
  Satisfy All
</IfModule>

# Apache ≥ 2.3
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>
</FilesMatch>

# SEO URL Settings
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 ^download/(.*) /index.php?route=error/not_found [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]

### 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.

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
# 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
php_value register_globals 0
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
php_value magic_quotes_gpc 0
# 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
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
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
# php_value max_execution_time 200
php_value max_execution_time 200
# 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
php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir none
#php_admin_value open_basedir none
php_value zlib.output_compression 0
</IfModule>

# * Caching and others *

ServerSignature Off

AddDefaultCharset utf-8
# Serve the following file types with the media type `charset`
# parameter set to `UTF-8`.
#
# https://httpd.apache.org/docs/current/mod/mod_mime.html#addcharset

<IfModule mod_mime.c>
    AddCharset utf-8 .atom \
                     .bbaw \
                     .css \
                     .geojson \
                     .js \
                     .json \
                     .jsonld \
                     .manifest \
                     .rdf \
                     .rss \
                     .topojson \
                     .vtt \
                     .webapp \
                     .webmanifest \
                     .xloc \
                     .xml
</IfModule>

# ----------------------------------------------------------------------
# | Cross-origin images                                                |
# ----------------------------------------------------------------------

# Send the CORS header for images when browsers request it.
#
# https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
# https://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
<IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
        <FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
            SetEnvIf Origin ":" IS_CORS
            Header set Access-Control-Allow-Origin "*" env=IS_CORS
        </FilesMatch>
    </IfModule>
</IfModule>

# ----------------------------------------------------------------------
# | Cross-origin web fonts                                             |
# ----------------------------------------------------------------------
# Allow cross-origin access to web fonts.
<IfModule mod_headers.c>
    <FilesMatch "\.(eot|otf|tt[cf]|woff2?)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

# Block access to directories without a default document.
#
# You should leave the following uncommented, as you shouldn't allow
# anyone to surf through every directory on your server (which may
# includes rather private places such as the CMS's directories).
<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# https://www.iana.org/assignments/media-types/media-types.xhtml
#
AddType application/x-font-woff2 .woff2

#
# configure mod_expires
#
# URL: http://httpd.apache.org/docs/2.2/mod/mod_expires.html
#
<IfModule mod_expires.c>
    ExpiresActive On

    #ExpiresDefault "access plus 1 hours"

    ExpiresByType image/x-icon "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType application/x-shockwave-flash "access plus 1 weeks"
    ExpiresByType text/css "access plus 1 weeks"
    ExpiresByType application/javascript "access plus 1 weeks"
    ExpiresByType text/javascript "access plus 1 weeks"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 months"
    ExpiresByType application/x-font-ttf "access plus 1 months"
    ExpiresByType application/x-font-truetype "access plus 1 months"
    ExpiresByType application/x-font-woff "access plus 1 months"
    ExpiresByType application/x-font-woff2 "access plus 1 months"
    ExpiresByType application/x-font-otf "access plus 1 months"
    ExpiresByType application/x-font-opentype "access plus 1 months"
    ExpiresByType image/svg+xml "access plus 1 weeks"
    ExpiresByType text/html "access plus 1 hours"
    ExpiresByType application/xhtml+xml "access plus 1 hours"
</IfModule>
#
# configure mod_headers
#
# URL: http://httpd.apache.org/docs/2.2/mod/mod_headers.html
#
<IfModule mod_headers.c>
    <FilesMatch "\\.(ico|jpe?g|png|gif|swf|woff2?|svg|ttf|eot|otf)$">
        Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <FilesMatch "\\.(css|less)$">
        Header set Cache-Control "max-age=604800, public"
    </FilesMatch>
    <FilesMatch "\\.(js)$">
        Header set Cache-Control "max-age=604800, private"
    </FilesMatch>
    <FilesMatch "\\.(x?html?)$">
        Header set Cache-Control "max-age=3600, private, must-revalidate"
    </FilesMatch>
     <filesMatch "\\.(php)$">
          Header set Cache-Control "max-age=4, private, must-revalidate"
     </filesMatch>

    #Header unset ETag
    Header unset Last-Modified
    #FileETag INode MTime Size
    FileETag MTime Size
</IfModule>
<IfModule mod_deflate.c>
    # Force compression for mangled `Accept-Encoding` request headers
    # https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html

    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    AddOutputFilterByType DEFLATE text/plain text/html text/css
    AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
    AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon
    AddOutputFilterByType DEFLATE application/x-font-woff application/x-font-woff2 application/x-font-truetype application/x-font-ttf application/x-font-opentype application/x-font-otf
</IfModule>

以上是关于apache_conf ocStrore 1.5 htaccess的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf Redireciones

apache_conf Seguridad .htaccess

apache_conf htaccess的

apache_conf 基本认证

apache_conf 配置地图

apache_conf 更改最长执行时间