从URL中间删除index.php,linux上的wordpress

从URL中间删除index.php,linux上的wordpress,php,linux,wordpress,.htaccess,Php,Linux,Wordpress,.htaccess,到目前为止,我已经尝试了以下代码: AddType x-httpd-php54 .php # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.

到目前为止,我已经尝试了以下代码:

AddType x-httpd-php54 .php

# 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
AddType x-httpd-php54.php
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

但我不知道我用它做错了什么。如果我转到URL.com/index.php,URL确实会重写,它将更改为URL.com/。但是如果我转到url.com/index.php/sample,url将不会重写。我想我在结尾遗漏了一个通配符,但我根本无法理解代码在做什么,所以很难调整。我试着在SE上查找,但找不到任何适用于linux/wordpress combo的东西。有什么想法吗?

实际上这个问题是用不同的方法解决的。遵循以下步骤:

步骤1:转到
wp admin

步骤2:打开设置>永久链接

步骤3:选中
帖子名称
选项并保存


你现在做完了。现在检查URL。

实际上,这个问题是以不同的方式解决的。遵循以下步骤:

步骤1:转到
wp admin

步骤2:打开设置>永久链接

步骤3:选中
帖子名称
选项并保存


你现在做完了。现在查看URL。

太棒了,很有魅力。毕竟不需要修改.htaccess文件!太棒了,很有魅力。毕竟不需要修改.htaccess文件!