The most suitable for magento. htaccess notation

Source: Internet
Author: User
Tags vars

Original Author Address: http://www.ctrol.cn/post/ecommercial/magento/12-05-ctrol-4057.html

############################################## These options is useful for Development#php_flag Display_startup_ Errors On#php_flag display_errors on#php_flag html_errors on#php_flag log_errors on#php_flag log_errors_max_len 0#php_ Value error_log/var/www/magento-lite/var/log/php_errors.log#################################################### ###################################### uncomment these lines for CGI mode## make sure to specify the correct CGI PHP Binar Y file name## It might be/cgi-bin/php-cgi# Action php5-cgi/cgi-bin/php5-cgi# AddHandler php5-cgi. php############# ################################# GoDaddy Specific Options options-multiviews## you might also need to add php.ini## Cgi.fix_pathinfo = 1## If it still doesn ' t work, rename php.ini to php5.ini################################ ############## this line was specific for 1and1 hosting #AddType x-mapp-php5. php #AddHandler x-mapp-php5. php####### ####################################### Default Index file DirectoryIndex index.php<ifmodule mod_php5.c>############################################## Adjust Memory Limit php_value memory_limit 128M php_value max_execution_time 18000######################################### ##### Disable Magic Quotes for PHP request VARs Php_flag MAGIC_QUOTES_GPC off########################################## # # # Disable automatic session start## before AutoLoad was initialized Php_flag Session.auto_start off################# ############################# enable resulting HTML compression Php_flag zlib.output_compression on################## ########################## Disable user agent verification to not break multiple image upload Php_flag suhosin.session. Cryptua off############################################ turn off compatibility with PHP4 when dealing with objects Php_ Flag Zend.ze1_compatibility_mode Off</ifmodule><ifmodule mod_security.c>############################# ############### Disable POST ProcessiNg to Don't break multiple image upload Secfilterengine Off secfilterscanpost off</ifmodule><ifmodule mod_def late.c>############################################## enable Apache served files compression##/http DEVELOPER.YAHOO.COM/PERFORMANCE/RULES.HTML#IPIP ############################################## Enable Apache Served files compression## http://developer.yahoo.com/performance/rules.html#gzip# Insert filtersetoutputfilter deflate# Netscape 4.x has some problems ... Browsermatch ^MOZILLA/4 gzip-only-text/html# Netscape 4.06-4.08 has some more problemsbrowsermatch ^mozilla/4\.0[678] no-gzip# MSIE masquerades as Netscape, but it's finebrowsermatch \bmsie!no-gzip!gzip-only-text/html# Don ' t compress ima Gessetenvifnocase request_uri \. (?: gif|jpe?g|png) $ no-gzip dont-vary# Make sure proxies don ' t deliver the wrong contentheader append vary user-agent env=! Dont-vary</ifmodule><ifmodule mod_ssl.c>############################################## make HTTPS env VaRS available for CGI mode ssloptions stdenvvars</ifmodule><ifmodule mod_rewrite.c>####################### ####################### enable rewrites Options +followsymlinks Rewriteengine on#################################### ########## can put here your Magento root folder## path relative to Web root #RewriteBase/magento/################ ############################## uncomment next line to enable light API calls processing# rewriterule ^api/([a-z][0-9a-z _]+)/?$ api.php?type=$1 [qsa,l]############################################## rewrite API2 calls to api.php REST only) rewriterule ^api/rest api.php?type=rest [qsa,l]############################################## workaround F or HTTP authorization## in CGI environment rewriterule. *-[e=http_authorization:%{http:authorization}]############### ############################### TRACE and track HTTP methods disabled to prevent XSS attacks Rewritecond%{request_meth OD} ^trac[ek] Rewriterule . *-[l,r=405]############################################## redirect for Mobile user agents #RewriteCond%{request_ur I}!^/mobiledirectoryhere/.*$ #RewriteCond%{http_user_agent} "Android|blackberry|ipad|iphone|ipod|iemobile|opera Mobile|palmos|webos|googlebot-mobile "[NC] #RewriteRule ^ (. *) $/mobiledirectoryhere/[l,r=302]##################### ######################### always send 404 on missing files in these folders Rewritecond%{request_uri}!^/(media|skin|j s)/############################################## never rewrite for existing files, directories and links rewritecond% {request_filename}!-f rewritecond%{request_filename}!-d rewritecond%{request_filename}!-l###################### ######################## rewrite everything else to index.php rewriterule. * index.php [l]</ifmodule>############ ################################## Prevent character encoding issues from server overrides## If you still has problems, u Se the second line instead ADDDefaultcharset Off #AddDefaultCharset utf-8<ifmodule mod_expires.c>######################################### ##### Add default Expires header## http://developer.yahoo.com/performance/rules.html#expires expiresdefault "Access pl US 1 year ' </ifmodule>############################################## by default ' Allow all Access Order Allow,deny Allow from all############################################# Deny access to release notes to prevent disclosure of the I nstalled Magento version <files release_notes.txt> order Allow,deny deny from all </Files> ############################################## If running in cluster environment, uncomment this##/HTTP/ Developer.yahoo.com/performance/rules.html#etags #FileETag None ############################################## Compress text, HTML, JavaScript, CSS, Xml:addoutputfilterbytype DEFLATE text/plainaddoutputfilterbytype DEFLATE text/ Htmladdoutputfilterbytype DEFLATE Text/xmladdoutputfilteRbytype DEFLATE text/cssaddoutputfilterbytype DEFLATE application/xmladdoutputfilterbytype DEFLATE application/xhtml +xmladdoutputfilterbytype DEFLATE application/rss+xmladdoutputfilterbytype DEFLATE application/ Javascriptaddoutputfilterbytype DEFLATE application/x-javascript# Or, compress certain file types by extension:< Files *.html>setoutputfilter deflate</files>########################################################### ##############################<ifmodule mod_expires.c># Enable expirationsexpiresactive On# Default Directiveexpiresdefault "Access plus 1 month" # My faviconexpiresbytype image/x-icon "Access plus 1 year?# imagesexpiresbyt ype image/gif "Access plus 1 month" Expiresbytype image/png "Access plus 1 month" Expiresbytype image/jpg "Access plus 1 mon Th "Expiresbytype image/jpeg" Access plus 1 month "# Cssexpiresbytype text/css" Access 1 month?# javascriptexpiresbytype app Lication/javascript "Access plus 1 year" </ifmodule>###########################################

The most appropriate htaccess for Magento.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.