【发布时间】:2018-07-04 03:33:36
【问题描述】:
我之前安装了几台 WordPress 服务器,但这是我第一次遇到这个问题,所有链接的 URL 中都必须包含“index.php”(即 test.com/games 而不是 test.com/index .php/games),我搜索了几个问题,这里有一个类似的线程:Remove index.php from Wordpress URLs 但它没有回答我的问题
HYG 来自我的服务器的一些细节:
1) mod_rewrite 已启用
2) 我有一个虚拟主机配置:
# domain name: test.com
# public: /var/www/test.com
# Admin email, Server Name (domain name) and any aliases
ServerAdmin test@gmail.com
ServerName test.com
ServerAlias www.test.com
# Index file and Document Root (where the public files are located)
# DirectoryIndex index.php
DocumentRoot /var/www/test.com
# Custom log file locations
LogLevel warn
ErrorLog /var/log/apache2/error-test.com.log
CustomLog /var/log/apache2/access-test.com.log combined
3) 我的 .htaccess 如下:
Options FollowSymLinks
AllowOverride All
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
4) WordPress 目录权限为rwsr_xr_x,其文件为rwx_r__r__ (owner www-data:www-data)
5) 永久链接配置为/%year%/%monthnum%/%day%/%postname%/
我对 .htaccess 格式不熟悉,所以可能需要对其进行一些调整,请指教?
【问题讨论】:
-
DirectoryIndex index.php为什么被注释掉了? -
它没有被注释掉,但我在尝试解决问题时注释掉了
-
我现在退回了,但同样的问题仍然存在
-
我注意到更改永久链接配置不会影响 .htaccess,因此我将其权限临时更改为 777,但这并没有解决问题