How to remove index.php from WordPress site URL
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.
Or Check if your hosting mod_rewrite is enable by creating a file phpinfo.php with content,
<?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.
More details Check this link
Rahul Ahirwar
Updated on July 07, 2022Comments
-
Rahul Ahirwar almost 2 years
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.
Now problem is that, I am unable to see my pages and posts without
index.php
.http://example.com/index.php/postname/
I have tried the following solutions:
Change permalinks setting (nothing changed).
Change rewrite module with .htaccess file (nothing changed).
Enable rewrite module in my apache2 server (nothing happened).
Deleted value of rewrite_module of wp_options table for cache purpose (nothing happened).
If i set 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 anybody provide me correct solution. How to get rid of
index.php
? -
Rahul Ahirwar over 8 yearswhen i see phpinfo it is already enable in Loaded Modules of apache2handler configuration section.