没有读取Apache .htaccess

时间:2015-09-06 18:19:03

标签: wordpress apache .htaccess mod-rewrite

我似乎无法弄清楚这一点。我在Ubuntu 14.04上使用Apache 2.4.7并且我启用了mod_headers。在我的/etc/apache2/apache2.conf文件中,我有以下默认的Directory语句:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

我试图通过在/etc/apache2/sites-available/000-default.conf中使用VirtualHosts覆盖我的实际网站目录来覆盖默认的apache2.conf配置:

<VirtualHost *:80>
        ServerAdmin blahblah@123456.so
        ServerName 999.999.999.999
        DocumentRoot /var/www/html/domains/website1
        <Directory /var/www/html/domains/website1>
                        Options -Indexes +FollowSymLinks
                        AllowOverride All
                        Order Deny,Allow
                        Allow from all
        </Directory>
</VirtualHost>

该网站工作正常但每当我尝试启用SEO友好URL时,我收到404错误,指出该页面不存在。这是位于/ var / www / html / domains / website1 /中的.htaccess文件(它是标准的Wordpress .htaccess文件):

# 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

任何想法都将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:1)

傻傻的我。当我填写表单的标签部分并且标签mod-rewrite弹出作为建议之一时,我想出来了。我需要启用mod_rewrite! Durp。好吧,感谢stackoverflow Web开发人员将该功能构建到站点中:)