- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我花了大约 48 小时尝试解决 gzip deflate 问题,并意识到我可能需要寻求帮助,呵呵。
在意识到我需要在 php.ini 文件中打开压缩之后,我终于通过 .htaccess 在我的共享 Unix 服务器上启用了 deflate 模块。
PageSpeed 告诉我,我的根 HTML 是使用 gzip 为网站进行编码的,并且我的 WordPress 网站 theoleandersofsanleon.com 获得了 77.3% 的压缩率,但任何子目录中的文件都没有被压缩(主要是 css 和 js 文件)在我的 WordPress 目录及其子目录中)。
我认为没有必要,但我继续尝试使用指令 Directory 和指令 Location 但无济于事。
如果您需要查看任何服务器规范,我在根目录中放置了一个 phpinfo.php 文件。
这是我的 htdocs 目录和 wordpress 目录的 .htaccess 文件中的内容:
<IfModule mod_deflate.c>
# Insert filters
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
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml
# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
如果您需要更多信息,请告诉我,非常感谢您的帮助,我们将不胜感激,我将能够开始让我的头发重新长出来 8-)
最佳答案
在顶级 .htaccess 文件中尝试此操作。这是在 cPanel 中使用优化器时生成的内容。
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# 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
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
关于wordpress - mod deflate 不压缩根目录的子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13871156/
我正在使用 prestashop,在主题中我添加了自己的目录,里面有一个样式表 然后我在 header.tpl 中链接了样式表 例如 但是,如果我在子目录中安装 prestashop,例如 www.
我有以下目录结构: C:\mywebsites \site_1 \site_2 \site_n 在“site_2”中,我安装了 joomla,但是,我在“额外”文件夹之一中有其他文件夹,其
我有一个家庭作业,要求我使用 bash 脚本在 Linux 终端中打印某些内容。我已经完成了其中的大部分,但我被困在我需要做的最后一件事上......这就是我的教授的措辞 Checks to see
通过 Windows Batch,删除文件夹的所有子目录和子文件而不删除/删除所述父/根文件夹的命令是什么? 到目前为止,这是我尝试过的: ECHO "Good riddance, cache! Mu
我正在将 OpenCV 用于各种对象检测器,但我发现很难编写可移植代码。 例如,要在通过自制软件安装了 OpenCV 的 Mac 上加载人脸检测器,我必须这样写: haar=cv.Load('/usr
目录树的主要部分有root(/)、/USR、/var、/home等等。下面是一个典型的linux目录结构如下: / 根目录 /bin 存放必要的命令 /boot
我被这个非常愚蠢的错误所困扰。我正在尝试使用 bluepy 在 Raspberry Pi 上运行 pytest。 pi@pi:~/bluepy/bluepy $ pytest test_asdf.py
我在 Ubuntu 14 上安装了 MediaWiki,该站点的 URL 为:www.wiki.example.com/mediawiki/ 但是我想将位置更改为 www.wiki.example.c
我已经阅读了文档,但有些事情仍然让我感到困惑,主要与同步文件夹和数据库数据有关。 我想在我的主机上使用以下文件夹结构 ROOT |- workFolder ||- project1 |||- proj
我想在我的 Azure webrole 启动时授予网络服务帐户修改权限(根项目目录),有人知道这样做的方法吗?修改后,我会重置该值以确保安全。主要目的是我需要修改 webconfig 以根据多个节点上
我需要作为自定义构建器的一部分按顺序运行两个程序。 其中一个程序我被困住了,无法处理绝对/相对路径,因此我必须使用构建器的 chdir=1 选项才能运行其操作与目标位于同一目录中。 第二个是位于项目的
Cmake的安装命令 install(TARGETS MyTarget LIBRARY DESTINATION lib) 要求我将共享库安装到子文件夹中。似乎 LIBRARY DESTINATION
我正在尝试运行这个: string webRoot = "http://www.dev/api"; string apiRoot = "http://api.dev"; string path = "
在 android 中,我可以使用以下方法获取手机的可移动外部存储: for (File f : context.getExternalFilesDirs("/")) if (Environm
当我启动 tomcat 时,它从 localhost:8080/开始服务。我希望它从 localhost:8080/aaa 开始服务。我不想用“aaa”webapp 替换“root”webapp,我希
我想在按下按钮时向页面顶部的根 html 标记添加一个类。我遇到的唯一代码是将类添加到具有 id 的 div 元素。 Untitled Document 开始演示 我尝试修改这段代码,但没
我希望了解 ROOT 的 TTreeReader 和 TVector3 类的人可以帮助我。 我正在尝试使用 TTreeReader 读取包含 TVector3 的 TTree。 class MuseS
我已经从已经运行并安装在我本地的服务器上下载了 prestashop 文件选择了默认主题,但未应用任何样式表例如,当我通过 Firebug 检查时,样式表路径是错误的我有 http://localho
我有一个脚本,用于搜索包含特定文件的目录,从当前目录开始向上爬(想想试图找出 .git 目录所在的位置)。 我的方法是这样的: def getDir(self,cwd): path = os.pa
我需要 检查当前目录是否在Git版本控制下 如果是 Git 根目录 在单行 shell 脚本中执行上述操作,成功时应以 0 退出 最佳答案 使用 git-rev-parse 是可行的方法。只需确保将其
我是一名优秀的程序员,十分优秀!