2

I have a problem with the .htaccess file in the root category of my server. It is not there. I searched for hours (google), but i haven't found any solutions. (Magento 1.9)

I activated "display hidden files" in Filezilla (I'm not working with APACHE - I'm working with a Testdomain), but it is still lost...

I need the .htaccess file for setting up Multilingual Websites on my Server.

The only .htaccess file I Found is the one in the var folder:

Order deny,allow Deny from all

Thanks.!

Dipesh Rangani
3,0354 gold badges22 silver badges44 bronze badges
asked Jun 24, 2014 at 19:53
2
  • Just copy one htaccess file from a clean instance Commented Jun 24, 2014 at 21:58
  • I think I solved it. I uploaded a Template with Quickstart. I extracted the "quickstart-template" file with my macbook...htaccess didn't appeare. Then I extacted it with another computer... htaccsess appeared... "That seems strange to me." Commented Jun 24, 2014 at 22:04

6 Answers 6

4

Have you tried uploading a new version / copy from your original Magento 1.9 download?

If you don't have this then grab another version via http://www.magentocommerce.com/download and see if that works.

answered Jun 24, 2014 at 20:12
4
  • You mean I should download Magento 1.9 again and upload it to my server? Commented Jun 24, 2014 at 20:20
  • 1
    No, you merely have to download the appropriate version .zip/.bzip/.gz file and dearchive it on your local workstation. All the files are there including the stock .htaccess file. Upload just that file to the server. Also is quite handy if you're experimenting and forgot to save a copy of any .phtml or .php file Magento uses before perpetrating mayhem <grin>. Commented Jun 25, 2014 at 1:01
  • I uploaed the .htaccess file, but now Internal Server Error 500. Commented Jun 25, 2014 at 6:11
  • This may have been caused by mismatched line ending formats between Linux / OSX / Windows or incorrect chmod permissions being applied to the file after extraction. @FiascoLabs suggestion was ideal because it should guarantee that you get a trusted copy from the authoritative source, Magento, and be sure it hasn't been modified or introduces vulnerabilities into your system that could be exploited later. The line ending issue is well-documented and you'll see it over and again working on the web Commented Jan 28, 2016 at 6:10
2

For me, it is just Hidden/Invisible. You should try click the the option display Hidden/Invisible file (depend on host) when open your File Manager.

answered Jun 5, 2015 at 4:21
2

try to login with ssh in Ubuntu terminal and use ls -all command you can also edit this file.

answered Jan 28, 2016 at 5:32
2

Stock 1.9 .htaccess

############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary 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 this line to php.ini
## cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini
############################################
## this line is 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 64M
 php_value memory_limit 256M
 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 not break multiple image upload
 SecFilterEngine Off
 SecFilterScanPOST Off
</IfModule>
<IfModule mod_deflate.c>
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
 # Insert filter on all content
 ###SetOutputFilter DEFLATE
 # Insert filter on selected content types only
 #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
 # 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
 # Don't compress images
 #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
 # Make sure proxies don't deliver the wrong content
 #Header 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
############################################
## you 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 (by now it is REST only)
 RewriteRule ^api/rest api.php?type=rest [QSA,L]
############################################
## workaround for HTTP authorization
## in CGI environment
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
 RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
 RewriteRule .* - [L,R=405]
<IfModule mod_setenvif.c>
 <IfModule mod_headers.c>
 ############################################
 # X-Content-Type-Options: nosniff disable content-type sniffing on some browsers.
 Header set X-Content-Type-Options: nosniff
 ############################################
 # This header forces to enables the Cross-site scripting (XSS) filter in browsers (if disabled)
 BrowserMatch \bMSIE\s8 ie8
 Header set X-XSS-Protection: "1; mode=block" env=!ie8
 </IfModule>
</IfModule>
############################################
## redirect for mobile user agents
 #RewriteCond %{REQUEST_URI} !^/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|js)/
############################################
## 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 have problems, use 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 plus 1 year"
</IfModule>
############################################
## By default allow all access
 Order allow,deny
 Allow from all
###########################################
## Deny access to release notes to prevent disclosure of the installed 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
###########################################
## Deny access to cron.php
 <Files cron.php>
############################################
## uncomment next lines to enable cron access with base HTTP authorization
## http://httpd.apache.org/docs/2.2/howto/auth.html
##
## Warning: .htpasswd file should be placed somewhere not accessible from the web.
## This is so that folks cannot download the password file.
## For example, if your documents are served out of /usr/local/apache/htdocs
## you might want to put the password file(s) in /usr/local/apache/.
 #AuthName "Cron auth"
 #AuthUserFile ../.htpasswd
 #AuthType basic
 #Require valid-user
############################################
 Order allow,deny
 Deny from all
 </Files>
answered Dec 31, 2018 at 15:45
0

You can download original htaccess file from http://www.magentocommerce.com/download. After downloading the Magento package you need, exact and get .htaccess file in the package.

In addition, you can also do some tweaks with your htaccess file to improve Magento website performance (reference source: Speed magento with htaccess file):

Enable Gzip Compression For Magento

Uncomment this line

#php_flag zlib.output_compression on

Compressing CSS and JavaScript files

Add these lines to htaccess

 # Compress HTML, CSS, JavaScript, Text, XML and fonts
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
 AddOutputFilterByType DEFLATE application/x-font
 AddOutputFilterByType DEFLATE application/x-font-opentype
 AddOutputFilterByType DEFLATE application/x-font-otf
 AddOutputFilterByType DEFLATE application/x-font-truetype
 AddOutputFilterByType DEFLATE application/x-font-ttf
 AddOutputFilterByType DEFLATE font/opentype
 AddOutputFilterByType DEFLATE font/otf
 AddOutputFilterByType DEFLATE font/ttf
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE image/svg+xml
 AddOutputFilterByType DEFLATE image/x-icon
</IfModule>

Enable Expires Headers

############################################
## Add Expires header to Magento - by Magentoexplorer.com
## http://developer.yahoo.com/performance/rules.html#expires
 <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
 ExpiresActive On
 ExpiresDefault "access plus 1 year"

Disable ETags

############################################
## http://developer.yahoo.com/performance/rules.html#etags
 FileETag none
answered Sep 7, 2016 at 7:08
-1

Here is my blog on .htaccess file in Magento.
http://blog.rahuldadhich.com/magento-speed-optimization-htaccess/

Hope this will help you.

answered May 16, 2017 at 9:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.