WordPress: Removing index.php in URLs

Original URLs:
URL after this tutorial:

It might just be something little, but I found that it really made a difference and made the URLs shorter.

You will need to create a file called .htaccess. You might already have one in your site files. Please check this first.

Log in to your site using your FTP program and search for .htaccess in the main directory. If you have one, download it.

If you don’t have one, create one by opening Notepad, and saving the file under the name .htaccess simply by typing it in the “file name” box.

With your .htaccess file, whether it is newly created or already has information, paste the following code into the file. If you have information in the file, simply place it on a new line at the bottom.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Save and upload the file to your main directory (should be public_html or what you first see when you log in to FTP).

The next step is to log in to WordPress on your website.

Go to Settings > Permalinks. Select the Custom Structure radio button. The input box is where you put the structure of links. Mine is set to /%postname%/.

Other variables can be used, like /%year%/, /%monthnum%/ and /%day%/. More can be found on Using Permalinks at The Codex.

Click “Save Changes” and when you view your pages, they should load without the index.php appearing in the URL.