【问题标题】:Linode ignores .htaccessLinode 忽略 .htaccess
【发布时间】:2015-12-29 18:21:21
【问题描述】:

这是我在 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 ##

【问题讨论】:

  • 它绝对适用于 Linode,因为我有几台服务器。它们只是普通的 linux 服务器。这是你的设置。按照 Jon Lin 的建议去做,看看它是否适合你。

标签: wordpress .htaccess linode


【解决方案1】:

确保为您的 htaccess 文件所在的目录(或文档根目录)设置了 AllowOverride 指令。

例如,如果您的 htaccess 文件位于 /var/www/htdocs/ 中,请确保您的 vhost 配置具有以下内容:

<Directory "/var/www/htdocs">
    AllowOverride All
</Directory>

或者至少是父目录的指令。如果您不想打开所有覆盖选项,我认为至少您需要FileInfo

<Directory "/var/www/htdocs">
    AllowOverride FileInfo
</Directory>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 2023-03-14
    • 2012-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-02
    相关资源
    最近更新 更多