Linode 忽略 .htaccess
Linode ignores .htaccess
这是我在 linode 实例上的 .htaccess(wordpress 站点)。即使我试图打破它,它也不起作用。
# BEGIN WordPress
<IfModule rewrite_module>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
确保为 htaccess 文件所在的目录(或文档根目录)设置了 AllowOverride
指令。
例如,如果您的 htaccess 文件位于 /var/www/htdocs/
中,那么请确保您的虚拟主机配置类似于:
<Directory "/var/www/htdocs">
AllowOverride All
</Directory>
或者至少,父目录的指令。我认为如果您不想打开所有覆盖选项,至少您需要 FileInfo
:
<Directory "/var/www/htdocs">
AllowOverride FileInfo
</Directory>
这是我在 linode 实例上的 .htaccess(wordpress 站点)。即使我试图打破它,它也不起作用。
# BEGIN WordPress
<IfModule rewrite_module>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
确保为 htaccess 文件所在的目录(或文档根目录)设置了 AllowOverride
指令。
例如,如果您的 htaccess 文件位于 /var/www/htdocs/
中,那么请确保您的虚拟主机配置类似于:
<Directory "/var/www/htdocs">
AllowOverride All
</Directory>
或者至少,父目录的指令。我认为如果您不想打开所有覆盖选项,至少您需要 FileInfo
:
<Directory "/var/www/htdocs">
AllowOverride FileInfo
</Directory>