From the Blogabout me

Removing /index.php/ from WordPress URL’s

Occasionally, I have clients ask why their URL’s for WordPress have changed or maybe they moved from one hosting provider to another and they now see /index.php/ in their URL.  This does not only pertain to WordPress though, as it could affect other Content Management Systems (CMS) or even general software.

Recently I was helped setup a person who had moved their WordPress site and a great billing/time tracking online system, that I encourage you to look into, called Pancake from Hostgator to InMotion. But once everything was moved over they noticed this issue in all URL’s and it caused Pancake to really act up without being any issue with Pancake itself, and just made WordPress links look ugly.  So that’s when I realized it was time for me to do a quick walk-through on how removing/index.php/ from WordPress URL’s without a plugin being needed.

So I want you to go into your .htaccess file within the root directory of your website. Open it with your favorite text editor, and make sure this information is there and at the top of the file. Save and put back on the server.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

Note, if you are using Rackspace, you may need to add a little more code:


<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On

# On some hosts (including Rackspace), you need to remove the "#" that comes before RewriteBase to avoid 404 errors:
# RewriteBase /

# Block access to hidden files and directories.
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpe?g|gif)$ $1.$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>

I realize this is not the most exciting topic, nor the easiest to explain, so if you have any questions please let me know.

Leave a Reply

%d bloggers like this: