【发布时间】:2017-02-14 13:25:34
【问题描述】:
我安装了 wordpress,但我收到了这个永久链接错误:
在此服务器上找不到请求的 URL /hello-world/。
这是我在根文件夹中的 .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
这是我的 apache2 配置文件:
<VirtualHost *>
ServerName x.ay.com
ServerAlias www.x.y.com
ServerAdmin x@y.ch
DocumentRoot /var/www/x/public_html
<Directory /var/www/x/public_html>
AllowOverride All
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.x.y.com [OR]
RewriteCond %{SERVER_NAME} =x.y.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
那怎么了?我有点想,对我的 .htaccess 的更改会被忽略吗? 但我想通了。我被重定向到网址中带有“/?/”的索引主页:
https://x.y.com/?/hello-world/
问题出在哪里?可能是 apache2 配置文件中的重写(我已经重写,以确保所有内容都重定向到 https?)。
感谢您的帮助!
【问题讨论】:
-
您是否尝试在服务器“a2enmod rewrite”上运行它?
-
@ezOSC 是的。它是“已启用”。还有其他想法吗?
标签: wordpress apache .htaccess mod-rewrite permalinks