Last active
April 7, 2021 00:41
-
-
Save tegansnyder/6609688 to your computer and use it in GitHub Desktop.
Example of bringing Magento's .htaccess file into your Apache http.conf file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NameVirtualHost *:80 | |
<VirtualHost *:80> | |
ServerName "www.domain.com" | |
ServerAlias domain.com | |
ErrorLog logs/error_log | |
TransferLog logs/access_log | |
LogLevel warn | |
ServerAdmin [email protected] | |
DocumentRoot /sites/magento | |
DirectoryIndex index.php index.html | |
FcgidIOTimeout 180 | |
############################################################## | |
<Directory "/sites/magento"> | |
Require all granted | |
SSLOptions +StdEnvVars | |
Options All -Includes +ExecCGI -Indexes +MultiViews | |
AllowOverride All | |
RewriteBase / | |
Options +FollowSymLinks | |
RewriteEngine on | |
RewriteRule ^api/rest api.php?type=rest [QSA,L] | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteCond %{REQUEST_METHOD} ^TRAC[EK] | |
RewriteRule .* - [L,R=405] | |
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule .* index.php [L] | |
DirectoryIndex index.php | |
<IfModule mod_php5.c> | |
php_value memory_limit 256M | |
php_value max_execution_time 7200 | |
php_flag magic_quotes_gpc off | |
php_flag session.auto_start off | |
php_flag suhosin.session.cryptua off | |
php_flag zend.ze1_compatibility_mode Off | |
</IfModule> | |
<IfModule mod_security.c> | |
SecFilterEngine Off | |
SecFilterScanPOST Off | |
</IfModule> | |
<IfModule mod_deflate.c> | |
SetOutputFilter DEFLATE | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
<IfModule mod_ssl.c> | |
SSLOptions StdEnvVars | |
</IfModule> | |
AddDefaultCharset Off | |
<IfModule mod_expires.c> | |
ExpiresDefault "access plus 1 year" | |
</IfModule> | |
Order allow,deny | |
Allow from all | |
<filesMatch ".(csv)$"> | |
Order deny,allow | |
Deny from all | |
</filesMatch> | |
<Files RELEASE_NOTES.txt> | |
order allow,deny | |
deny from all | |
</Files> | |
<Files EXTENSION_INSTALL.txt> | |
order allow,deny | |
deny from all | |
</Files> | |
FileETag none | |
</Directory> | |
<Directory "/sites/magento/app"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/downloader"> | |
<IfModule mod_deflate.c> | |
RemoveOutputFilter DEFLATE | |
RemoveOutputFilter GZIP | |
</IfModule> | |
<Files ~ "\.(cfg|ini|xml)$"> | |
order allow,deny | |
deny from all | |
</Files> | |
</Directory> | |
<Directory "/sites/magento/downloader/template"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/export"> | |
allow from all | |
</Directory> | |
<Directory "/sites/magento/errors"> | |
<FilesMatch "\.(xml|phtml)$"> | |
Deny from all | |
</FilesMatch> | |
</Directory> | |
<Directory "/sites/magento/includes"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/lib"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/media"> | |
Options All -Indexes | |
<IfModule mod_php5.c> | |
php_flag engine 0 | |
</IfModule> | |
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi | |
Options -ExecCGI | |
<IfModule mod_rewrite.c> | |
Options +FollowSymLinks | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule .* ../get.php [L] | |
</IfModule> | |
</Directory> | |
<Directory "/sites/magento/media/customer"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/media/downloadable"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/pkginfo"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/var"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
############################################################### | |
<Files ~ "\.(cgi|shtml|phtml|php3?)$"> | |
</Files> | |
<IfModule mod_alias.c> | |
</IfModule> | |
SetEnvIf User-Agent ".*MSIE.*" \ | |
nokeepalive ssl-unclean-shutdown \ | |
downgrade-1.0 force-response-1.0 | |
</VirtualHost> | |
<VirtualHost *:443> | |
RewriteMap lc int:tolower | |
ServerName www.domain.com:443 | |
ServerAlias domain.com | |
DocumentRoot /sites/magento | |
SSLEngine On | |
SSLProtocol all -SSLv2 | |
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW | |
SSLCertificateFile /etc/certs/domain.com.crt | |
SSLCertificateKeyFile /etc/certs/domain.com.key | |
SSLCertificateChainFile /etc/certs/COMODOHigh-AssuranceSecureServerCA.crt | |
ErrorLog logs/ssl_error_log | |
TransferLog logs/ssl_access_log | |
LogLevel warn | |
ServerAdmin [email protected] | |
DirectoryIndex index.php index.html | |
FcgidIOTimeout 180 | |
<Directory "/sites/magento"> | |
Require all granted | |
SSLOptions +StdEnvVars | |
Options All -Includes +ExecCGI -Indexes +MultiViews | |
AllowOverride None | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteCond %{REQUEST_URI} !^/(media|skin|js|api)/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule .* index.php [L] | |
DirectoryIndex index.php | |
<IfModule mod_php5.c> | |
php_value memory_limit 512M | |
php_value max_execution_time 7200 | |
php_flag magic_quotes_gpc off | |
php_flag session.auto_start off | |
php_flag suhosin.session.cryptua off | |
php_flag zend.ze1_compatibility_mode Off | |
</IfModule> | |
<IfModule mod_security.c> | |
SecFilterEngine Off | |
SecFilterScanPOST Off | |
</IfModule> | |
<IfModule mod_deflate.c> | |
SetOutputFilter DEFLATE | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
<IfModule mod_ssl.c> | |
SSLOptions StdEnvVars | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
Options +FollowSymLinks | |
RewriteEngine on | |
RewriteRule ^api/rest api.php?type=rest [QSA,L] | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteCond %{REQUEST_METHOD} ^TRAC[EK] | |
RewriteRule .* - [L,R=405] | |
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteRule .* index.php [L] | |
</IfModule> | |
AddDefaultCharset Off | |
<IfModule mod_expires.c> | |
ExpiresDefault "access plus 1 year" | |
</IfModule> | |
Order allow,deny | |
Allow from all | |
<Files RELEASE_NOTES.txt> | |
order allow,deny | |
deny from all | |
</Files> | |
FileETag none | |
</Directory> | |
<Directory "/sites/magento/app"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/downloader"> | |
<IfModule mod_deflate.c> | |
RemoveOutputFilter DEFLATE | |
RemoveOutputFilter GZIP | |
</IfModule> | |
<Files ~ "\.(cfg|ini|xml)$"> | |
order allow,deny | |
deny from all | |
</Files> | |
</Directory> | |
<Directory "/sites/magento/downloader/template"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/export"> | |
allow from all | |
</Directory> | |
<Directory "/sites/magento/errors"> | |
<FilesMatch "\.(xml|phtml)$"> | |
Deny from all | |
</FilesMatch> | |
</Directory> | |
<Directory "/sites/magento/includes"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/lib"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/media"> | |
Options All -Indexes | |
<IfModule mod_php5.c> | |
php_flag engine 0 | |
</IfModule> | |
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi | |
Options -ExecCGI | |
<IfModule mod_rewrite.c> | |
Options +FollowSymLinks | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule .* ../get.php [L] | |
</IfModule> | |
</Directory> | |
<Directory "/sites/magento/media/customer"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/media/downloadable"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/pkginfo"> | |
Order deny,allow | |
Deny from all | |
</Directory> | |
<Directory "/sites/magento/var"> | |
<Files *> | |
Deny From All | |
</Files> | |
</Directory> | |
<Files ~ "\.(cgi|shtml|phtml|php3?)$"> | |
SSLOptions +StdEnvVars | |
</Files> | |
<IfModule mod_alias.c> | |
</IfModule> | |
SetEnvIf User-Agent ".*MSIE.*" \ | |
nokeepalive ssl-unclean-shutdown \ | |
downgrade-1.0 force-response-1.0 | |
CustomLog logs/ssl_request_log \ | |
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment