Last active
January 19, 2018 17:50
-
-
Save AnupRaj/efb748616c9942bd8dc07e450cc16f1e to your computer and use it in GitHub Desktop.
This file contains 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
Following .htaccess entry was not working | |
upon examining properly, following code is just fine. | |
## EXPIRES CACHING ## | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access plus 1 year" | |
ExpiresByType image/jpeg "access plus 1 year" | |
ExpiresByType image/gif "access plus 1 year" | |
ExpiresByType image/png "access plus 1 year" | |
ExpiresByType text/css "access plus 1 month" | |
ExpiresByType application/pdf "access plus 1 month" | |
ExpiresByType text/x-javascript "access plus 1 month" | |
ExpiresByType application/x-shockwave-flash "access plus 1 month" | |
ExpiresByType image/x-icon "access plus 1 year" | |
ExpiresDefault "access plus 2 days" | |
</IfModule> | |
## EXPIRES CACHING ## | |
in Debian, Apache conf is located at /etc/apache2/apache2.conf | |
The .htaccess is only funtional if AllowOverride is set to All in this conf file. | |
See in <Directory /var/www/> | |
The correct code would be | |
<Directory /var/www/> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
AllowOverride All; as in the code above will let .htaccess to work. | |
Now, Need to enable Expires Caching (if not enabled) | |
run following command in terminal | |
sudo a2enmod expires | |
sudo systemctl restart apache2 | |
This enabled Expires Caching, also .htaccess is working just fine | |
A quick test to see Expires: date is to use following code in terminal | |
wget -S https://login.plus/ | |
check for Expires: Date | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment