链接在Wordpress 4.1中不起作用

链接在Wordpress 4.1中不起作用,wordpress,apache,.htaccess,mod-rewrite,Wordpress,Apache,.htaccess,Mod Rewrite,我在DigitalOcean上有Wordpress 4.1应用程序 安装后,我发现除了根/主链接之外的任何其他链接都无法工作 我研究了类似的问题并尝试: 1) 将永久链接更改为默认设置 现在链接部分工作。我的意思是它们很丑:http://104.131.95.146/?post_type=product而不是http://104.131.95.146/products 根据建议,我从以下方面进行了一些故障排除: Pretty permalinks可在以下位置获得: 带有mod_重写模块的Apac

我在DigitalOcean上有Wordpress 4.1应用程序

安装后,我发现除了根/主链接之外的任何其他链接都无法工作

我研究了类似的问题并尝试:

1) 将永久链接更改为默认设置

现在链接部分工作。我的意思是它们很丑:
http://104.131.95.146/?post_type=product
而不是
http://104.131.95.146/products

根据建议,我从以下方面进行了一些故障排除:

Pretty permalinks可在以下位置获得: 带有mod_重写模块的Apache web服务器

但我的服务器是Apache,我检查了mod_rewrite是否可以使用:

apache2ctl -M | grep rewrite
收到这个消息:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
 rewrite_module (shared)
尝试重新启动apache和我的droplet,但仍然存在相同的问题

var/www/html/.htaccess中的我的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
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
任何帮助都会很好


提前感谢。

再次由我自己修复

我跳过了Wordpress安装的重要部分

我所做的:

默认情况下,这是000-default.conf,但如果您创建了另一个配置文件,则您的文件可能会有所不同:

sudo nano /etc/apache2/sites-available/000-default.conf
在这个文件中,我们想设置一些东西。我们应该设置服务器名并创建一个允许覆盖的目录部分。这应该是这样的:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ServerName server_domain_name_or_IP
    <Directory /var/www/html/>
        AllowOverride All
    </Directory>
    . . .
进行这些更改后,请重新启动Apache:

sudo service apache2 restart
sudo service apache2 restart