Does anyone know how I can get rid of index.php in my URL? Right now if I add a new page, the address will be:

www.mywebsite.com/index.php/page1

But I want it to be:

wwww.mywebsite.com/page1

I surfed the web a lot! Changing the permalink doesn't work. Does anyone know how I can fix this?

up vote 4 down vote accepted

This is a classical case. All you need to do is to use Rewrite Rules. With Apache, you can do it in .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

More on this in codex.

  • If setting RewriteRule in .htaccess doesn't work, then make sure your apache configuration is set properly. AllowOverride All instead of AllowOverride None. Check here. – Fayaz Mar 23 '17 at 11:15
  • Thank you so much! Worked after changing both .htaccess and apache configuration. – geek2000 Mar 23 '17 at 19:16
  • wordpress for my other website resides at /var/www/html/wordpress/ (and not at /var/www/html/) and the solution didn't work for this one. Do you know why? And how I can fix it? Thank you. – geek2000 Mar 24 '17 at 2:51

first try to change the permalinks in general setting of you website dashboard.....if not then you have to edit your .htaccess file....hope this will help to resolve the issue..!!

  • 1
    Without the permalink setting from wp-admin you'll get URL like http://example.com/?p=N. So it's definitely not that. – Fayaz Mar 23 '17 at 11:10

I was also a victim of this error.But Now have solved the issue in CWP permalink index.php remove solution as follow:

Create a .htacess file in the root directory of your website /public_html/yoursite.com

Write the following code in it

# 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

then Goto wp-admin >>> settings >>> permalinks

Select "Custom Structure" and remove "index.php" only from it

Save and check ... It works perfectly!

thanks at all

  • How is your solution different from Scott's?? – geek2000 May 5 at 7:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.