Wordpress和Apache VirtualHosts 404错误永久链接“日期和名称”问题

时间:2016-02-22 19:14:38

标签: wordpress apache http-status-code-404 virtualhost permalinks

我不能为我的生活弄清楚让Wordpress与我的Apache服务器上的相当永久链接一起工作。我在网上搜索并尝试了无数组合的东西。相关网址为www.trixiebangbang.com。我在Ubuntu上运行一个传统的LAMP堆栈,所有这些堆栈都是用AWS托管的。

我希望Wordpress“Day and Name”永久链接工作。我已经在Wordpress中选择了它并更新了我的.htaccess文件并赋予它755权限:

# .htaccess file
# 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

当我查看我的博文时,仍然会导致404错误。例如,如果我转到this example blog post则不起作用。然后我将/etc/apache2/sites-enabled/000-default.conf配置文件更新为以下内容:

# 000-default.conf file
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory />
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

我非常小心并确保在测试之前进行的每次更改后执行“sudo service apache2 restart”。有人可以告诉我这里有什么问题吗?提前谢谢。

1 个答案:

答案 0 :(得分:0)

经过更多的搜索,我能够拼凑出一个对我有用的解决方案。我将000-default.conf文件更新为以下内容并重新启动了服务器。我希望这有助于其他人。

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName trixiebangbang.com

        DocumentRoot /var/www/html

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet