How to Remove Index.php From URL in WordPress

Are you looking for an easy way to remove index.php from your WordPress website’s URLs? If yes, you landed on the right spot!

The index.php is a common part of WordPress URLs that can make them look cluttered and unprofessional. Thankfully, removing index.php from your URLs is an easy process that just requires a few simple steps.

In this blog, I will explain what index.php is, why you should remove it from your URLs, and how to remove it from your WordPress website.

So, without wasting time, let’s get started!

Why Remove Index.php From URL?

Removing index.php from the URL of your website is a great way to improve the user experience and SEO of your website. This is because it helps to make URLs more readable and easier to remember for both users and search engines.

It also helps search engine crawlers better understand and index your content, which can lead to improved rankings in SERPs.

How to Remove Index.php From WordPress URL

One of the primary causes of WordPress permalink errors related to index.php is migrating from one hosting provider to another. This can lead to complications that can manifest as an index.php error in your permalinks.

Below, I have mentioned two methods by which you can easily get rid of index.php from URLs in WordPress.

  • Set Your Permalink Structure Settings
  • Add Custom Code to .htaccess File

Once you’ve completed all the steps, you’ll be able to take advantage of cleaner, more professional-looking URLs on your WordPress website.

Method 1: Set Your Permalink Structure Settings

In the first method, you have to make changes to your permalink structure settings in WordPress. If you see the URL of a page ending with index.php, it might be due to improper configuration of permalinks in the WordPress Settings.

permalink structure in wordpress
Permalink Structure in WordPress

To verify if the permalink structure is properly set or not, go to “Settings > Permalinks”; here, you will see several settings. Next, select “Post name” under common settings and save the changes as shown in the above image.

I hope this method resolves the index.php issue in your WordPress blog URLs. But, if your permalink setting is already set to post name, then this method will not work for you. Don’t worry; you can use the second method described below.

Method 2: Add Custom Code to .htaccess File

The first method is most recommended, but if it doesn’t solve your problem, then you can try this method. In this method, you have to add a small piece of code to your .htaccess file.

opening "public_html" folder
Opening “public_html” Folder

To get started, log in to your cPanel, open File Manager, and here you have to open the public_html folder as shown in the above image.

Enabling hidden files

Next, find the .htaccess file in the public_html folder. If you were not able to find this file, then click on Settings and enable the “Show Hidden Files” option. Now, you can see the .htaccess file.

Add .htaccess Rewrite Code

In this step, you have to copy and paste the below code into the .htaccess file. Simply, edit the file and add the code.

Still, if you are able to remove the index.php from the URL in WordPress, then it means your site has very tight security. In this case, you also have to add the below code to the .htaccess file.

Final Words

Removing index.php from your WordPress URL is an easy process that can help improve the usability and readability of your website. By following the steps outlined in this article, you can easily remove the index.php from the URL in WordPress and make your website URL look more professional and user-friendly.

The process involves changing some settings in the WordPress dashboard, editing your .htaccess file, and updating your permalinks. With a few simple steps, you can get rid of the index.php

I hope you enjoyed this guide. If yes, don’t forget to share it with your friends and leave your feedback in the comment section below.

Sunny Kumar

Number of posts: 145

Hi, I'm Sunny Kumar, a passionate tech enthusiast and a blogger from New Delhi, India. With a degree in IT from IIT-D and expertise in SEO, Cloud Computing, Telecom & Networking, and CEH, I specialize in various technical fields, including SEO, WordPress Development, and PC Building. And being a proficient WordPress user, I’m dedicated to delivering quality content and a remarkable user experience.

Leave a Comment