How to remove index.php from WordPress site URL

I have a problem with index.php on my WordPress website. This problem occurs since you make changes and migrate my WordPress database from WordPress to mydatabase. I also changed the table prefix name.

Now the problem is that I can not see my pages and posts without index.php .

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

I tried the following solutions:

  • Change the permalink setting (nothing has changed).

  • Change the rewrite module with the .htaccess file (nothing has changed).

  • Enable rewrite module on my apache2 server (nothing happened).

  • Removed the rewrite_module value of the wp_options table for the cache target (nothing happened).

  • If I set a permalink for% postname%

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

Then I get 404 error.

My .htaccess code is:

 # 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 give me the right solution. How to get rid of index.php ?

+8
php mysql apache wordpress .htaccess
source share
1 answer

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

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

 <?php phpinfo();?> 

Download this file and view it through a browser. So, you know which modules are included. You need mod_rewrite to allow the removal of index.php from the URL.

Details Check out this link

+4
source share

All Articles