首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >所有链接中都有奇怪的WordPress index.php

所有链接中都有奇怪的WordPress index.php
EN

Stack Overflow用户
提问于 2018-07-04 03:16:07
回答 1查看 82关注 0票数 0

我之前安装了几个WordPress服务器,但这是我第一次遇到这个问题,所有的链接都必须在URL中有'index.php‘(即,不是test.com/WordPress,而是test.com/index.php/index.php),我搜索了几个问题,这里有一个类似的帖子:Remove index.php from Wordpress URLs,但它没有给出我的问题的答案

HYG来自我的服务器的一些详细信息:

1)启用mod_rewrite

2)我有一个虚拟主机配置:

代码语言:javascript
复制
# 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如下:

代码语言:javascript
复制
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格式不熟悉,所以可能需要调整一些,请告诉我?

EN

回答 1

Stack Overflow用户

发布于 2018-07-04 03:33:37

正常的wordpress .htaccess是下面的

代码语言:javascript
复制
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L] //you aren't escaping in your example
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51161570

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档