如何从WordPress站点URL中删除index.php

Rah*_*war 7 php mysql apache wordpress .htaccess

我的WordPress网站上的index.php有问题.这个问题来了,因为我已经更改并将我的WordPress数据库从WordPress迁移到mydatabase.我也改变了我的表前缀名称.

现在的问题是,我无法看到我的页面和帖子index.php.

http://example.com/index.php/postname/

我尝试了以下解决方案:

  1. 更改永久链接设置(没有更改).

  2. 使用.htaccess文件更改重写模块(没有更改).

  3. 在我的apache2服务器中启用重写模块(没有任何反应).

  4. 为缓存目的删除了wp_options表的rewrite_module值(没有发生).

  5. 如果我为%postname设置永久链接%

例如http://example.com/postname/

然后我得到404错误.

我的.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
Run Code Online (Sandbox Code Playgroud)

请有人给我正确的解决方案.怎么摆脱index.php

Mak*_*uri 5

转到您的WP-ADMIN->设置->永久链接,并在其中使用永久链接结构更改(如果它生成任何.htaccess文件),请复制内容并更新您的.htaccess文件。

或通过创建包含内容的文件phpinfo.php来检查是否启用了托管mod_rewrite,

<?php phpinfo();?>
Run Code Online (Sandbox Code Playgroud)

上载此文件并通过浏览器浏览。因此,您知道启用了哪些模块。您需要mod_rewrite enable从URL中删除index.php。

更多详细信息,请检查此链接