Reputation: 11
.htaccess
file in the root directory and it is working perfectly fine for desktop users as the files for the desktop site are in the root directory but as for my mobile site the .htaccess
file does not seem to work as the mobile site files are in a sub directory named m
.
So basically I'm trying to add this code in .htaccess
file
<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 plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
And when I check Google page speed test its working perfectly for desktop site but as for mobile it isn't so do I have to make a separate .htaccess
file for the sub directory and if yes what do I have to add in that or can I just edit the current one so that it starts working for that m
sub directory?
Upvotes: 0
Views: 403
Reputation: 11
Only a partial answer, but the Apache web server documentation says that .htaccess files apply to the directory they are in, "and to all subdirectories thereof". So you shouldn't need to create a separate .htaccess for the m
sub-directory, or do anything special in your original .htaccess to make it apply to the sub-directory.
Is your web server Apache? Perhaps other web servers treat .htaccess files differently.
Upvotes: 1