如何从WordPress站点URL中删除index.php [重复]

时间:2021-08-06 11:19:08

This question already has an answer here:

这个问题在这里已有答案:

I have a problem with index.php in my WordPress website. This problem is arriving since I have changed and migrated my WordPress database from WordPress to mydatabase. I have also changed my table prefix name.

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

Now problem is that, I am unable to see my pages and posts without index.php.

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

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

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

I have tried the following solutions:

我尝试了以下解决方案:

  1. Change permalinks setting (nothing changed).

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

  2. Change rewrite module with .htaccess file (nothing changed).

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

  3. Enable rewrite module in my apache2 server (nothing happened).

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

  4. Deleted value of rewrite_module of wp_options table for cache purpose (nothing happened).

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

  5. If i set permalink for %postname%

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

e. g. http://example.com/postname/

即G。 http://example.com/postname/

Then i get 404 error.

然后我得到404错误。

My .htaccess code is:

我的.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

Please anybody provide me correct solution. How to get rid of index.php?

请有人给我正确的解决方案。如何摆脱index.php?

1 个解决方案

#1


4  

Go to your WP-ADMIN-->Settings-->Permalink and use the permalink structure change there, if it generate any .htaccess file copy the content and update your .htaccess file.

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

Or Check if your hosting mod_rewrite is enable by creating a file phpinfo.php with content,

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

<?php phpinfo();?>

Upload this file and browse via Browser. So you know which modules are enabled. You need mod_rewrite enable to remove index.php from URL.

上传此文件并通过浏览器浏览。所以你知道哪些模块已启用。您需要mod_rewrite enable从URL中删除index.php。

More details Check this link

更多细节请检查此链接

#1


4  

Go to your WP-ADMIN-->Settings-->Permalink and use the permalink structure change there, if it generate any .htaccess file copy the content and update your .htaccess file.

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

Or Check if your hosting mod_rewrite is enable by creating a file phpinfo.php with content,

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

<?php phpinfo();?>

Upload this file and browse via Browser. So you know which modules are enabled. You need mod_rewrite enable to remove index.php from URL.

上传此文件并通过浏览器浏览。所以你知道哪些模块已启用。您需要mod_rewrite enable从URL中删除index.php。

More details Check this link

更多细节请检查此链接