Wordpress永久链接无法在新服务器上工作


Wordpress Permalinks Not Working On New Server

我的服务器最近被破坏了。我把所有东西都移到了一个新的服务器上,但由于某种原因,Wordpress网站的永久链接无法正常工作。我已经检查了所有内容,看起来都是正确的,但我不明白为什么当所有设置都从旧服务器复制过来时,链接就不起作用了。

Server.conf:

<VirtualHost *:80>    
ServerName www.XXX.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/XXX.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<VirtualHost *:80>
ServerAlias XXX.com
ServerAdmin XXX
DocumentRoot /var/www/html/XXX.com/
ServerName www.XXX.com
DirectoryIndex index.html index.php
<Directory "/var/www/html/www.XXX.com/">
    allow from all
    Options -Indexes
    AllowOverride All
</Directory>
CustomLog ${APACHELOGDIR}/XXX.log common
ErrorLog ${APACHELOGDIR}/XXX-error.log
</VirtualHost>

.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

确保.htaccess具有正确的权限,以便wordpress可以自行更改它。