9

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?

Armali
  • 18,255
  • 14
  • 57
  • 171
Rahul Ahirwar
  • 99
  • 1
  • 1
  • 3
  • Can you post your .htaccess? –  Sep 17 '15 at 11:31
  • you need to include .htaccess file into this question. – Robert Sep 17 '15 at 11:37
  • If you visit a none-existant page do you get the 404 Wordpress error page (usually themed) or the 404 server page (usually only plain text) ? e.g. http://example.com/fakelocation/ – Steve E. Sep 17 '15 at 11:39
  • Just search google there are lot of answers. **If i can, I will make this post duplicate to [Google](https://www.google.lk/search?q=remove+index.php+from+wordoress+site+url&oq=remove+index.php+from+wordoress+site+url&aqs=chrome..69i57j0l2j69i60.239j0j7&sourceid=chrome&es_sm=122&ie=UTF-8)** – Abdulla Nilam Sep 17 '15 at 11:44
  • 1
    http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/ Above link is useful for window server, but I'm using Linux server – Rahul Ahirwar Sep 17 '15 at 11:56
  • Try to do some random RewriteRule to see if it's a server issue or a wordpress issue. – vard Sep 17 '15 at 12:54
  • @Moderator That question is about IIS, not Apache. – Uyghur Lives Matter Sep 17 '15 at 13:45
  • Anything in your error logs? Sure your .htaccess file is readable by the apache process? – Matt Gibson Sep 17 '15 at 13:55
  • To note: I marked as unclear - not a duplicate. Your issue is not htaccess. Even without pretty permalinks, you should be able to access root. Make sure your Apache has mod rewrite active. – Aibrean Sep 17 '15 at 14:30

1 Answers1

7

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

Maksud Mansuri
  • 631
  • 13
  • 26