Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

location of .htaccess file

/var/www/html/My_project_folder is the path to my project. I did not find .htaccess file. I want to paste my edited .htaccess file . but i am not sure in which location i need to put? My htaccess file code is--

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 <IfModule mod_expires.c>

 # Enable expirations
 ExpiresActive On

 # Default directive
 ExpiresDefault "access plus 1 month"

 # My favicon
 ExpiresByType image/x-icon "access plus 1 year”

 # Images
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/jpg "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"

 # CSS
 ExpiresByType text/css "access 1 month”

 # Javascript
 ExpiresByType application/javascript "access plus 1 year"

 </IfModule>

 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript

This code i added in .htaccess file to speed up of my site. Please help me for location of .htaccess file. Thanks in Advance!

like image 593
Unique Avatar asked Nov 05 '14 12:11

Unique


2 Answers

Usually this file goes to the root of your website (where your index.php file is). If there is none, you can create a new file. But watch out not to create something like ".htaccess.txt" if you do it with notepad (which usually appends .txt to all files).

like image 194
Kirschi Avatar answered Oct 20 '22 02:10

Kirschi


You need to paste the .htaccess file on the root of your project. It's possible that your .htaccess is hidden ... try to look into the folder using the terminal instead of the DM and if it's not there try to create a new file from the terminal using the command.

nano .htaccess (linux users)
edit .htaccess (windows users)

like image 44
davide andreazzini Avatar answered Oct 20 '22 02:10

davide andreazzini