Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove index.php from WordPress site URL [duplicate]

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:

  1. Change permalinks setting (nothing changed).

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

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

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

  5. 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?

like image 607
Rahul Ahirwar Avatar asked Sep 17 '15 11:09

Rahul Ahirwar


1 Answers

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

like image 82
Maksud Mansuri Avatar answered Nov 18 '22 01:11

Maksud Mansuri