0

.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?

4

1 回答 1

1

只是部分答案,但Apache Web 服务器文档说 .htaccess 文件适用于它们所在的目录,“及其所有子目录”。因此,您不需要为m子目录创建单独的 .htaccess,或者在原始 .htaccess 中执行任何特殊操作以使其适用于子目录。

你的网络服务器是 Apache 吗?也许其他 Web 服务器对 .htaccess 文件的处理方式不同。

于 2015-04-17T21:00:54.887 回答