How to remove index.php in WordPress URL (resolved)

How to Hide or Remove Index.php in WordPress URL?

How to Hide or Remove Index.php in WordPress URL?

We all know how vital a clean URL is from the SEO or user experience point of view. That’s why if there is an error like index.php in WordPress URL, then this might be annoying. Furthermore, it will also show error 404.

Due to this issue, you will also starve in rankings if you are some of those beginners who just entered the field and want to know the solution. You are just at the right place. Let’s quickly jump into it and discover why and how to remove index.php in WordPress URLs.

How to Remove Index.php in WordPress URL?

There are several reasons behind this WordPress permalink error of index.php. Among all, one of the biggest reasons includes your migration from one hosting to another. Meanwhile, if you still need to do your permalink settings, it can also cause an index.php issue in WordPress URL.

So, if your Permalink or WordPress URL looks like this, you must change it into an ideal and user-friendly URL, including your post name only, that will look like this Don’t worry. Here are the two quick and easy methods through which you can also hide index.php in WordPress URL. From WordPress SEO and other Points of view Peoples Normally Keep their URLs good and Attractive for their users It is important to grab attention.

(Method # 1): Set your permalink structure

So, the first comes first. If you had not migrated your site from one hosting to another, the index.php error must be because you needed to set up the permalink settings. That’s why we will show you one of the most accessible solutions through which you can also remove index.php in the WordPress URL.

All you need to do is;

  • Log in to your WordPress dashboard.
  • Next, go to settings and then permalink.
  • A page will show you the various URL structures, from plain and numeric to post names.
  • You can also set the customized URL structure here, but we recommend using the Post name as it’s more SEO and user-friendly as shown in the image.
  • So, once you are done with your desired settings, remember to save the changes.
Permalink Structure in WordPress Website dashboard

This most specific setting will resolve your index.php issue in WordPress URL. But, if it still appears, then use the below-mentioned method.

(Method # 2): Add Code to htaccess

Although we recommend trying the first method first, if it doesn’t work, then you need to use a short code in your custom htaccess file. Don’t worry. The process is straightforward, and we will walk you through this.

So, without further ado, let’s find out which steps you need to take to remove index.php from your WordPress URL.

  • Login to your WordPress Cpanel, go to the file manager, and look for public_html.
  • Here you will find a file named .htaccess.
  • For example, if you didn’t find this file, you may need to go to settings and click on the show hidden files option to check and save the .htaccess file.
  • Once done, insert the short Code below into this file.
# 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]


# END WordPress
  • Now, paste the Code mentioned above by clicking on the edit button.
  • Lastly, remember to save and apply the changes, and the index.php from your WordPress URL will be removed.
  • Suppose you tried the above mentioned Code, but it didn’t work; here is another code you need to try. Usually, this happens if you have a tight mod_security on your web server. It will block your php file settings, and the URL will remain the same. That’s why you need to try this Code.
<IfModule mod_security.c>

SecFilterEngine Off

  • Applying these two codes will resolve your index.php error in WordPress URL. If it gets successfully done, then after saving the file, you will see a message “mod-rewrite is activated!” if not, then a message will appear concluding “mod-rewrite disabled!”
  • If this happened to you and you are unable to change the settings, then make sure to delete the previous .htaccess file and rename the original one with .htaccess

Disclaimer: Before you apply all these settings, make sure to enable the “mod-rewrite” on your server.

Quick Takeaways:

Why remove index.php in WordPress URL?

One of the biggest reasons is that this error will lead you to an error of 404. If not, URLs, including index.php in the last, were not considered user-friendly. Furthermore, if you are targeting a long tail keyword, then the index.php given at the end will shorten the URL, which won’t look good.

Why is there index.php in my WordPress URL?

Two common reasons for this include your migration from one hosting to another or the need to reconsider your permalinks default settings.

Problem Solved?

If you are giving it a read till the end, you got the answer and can now remove the index.php in WordPress URL. Furthermore, once you finish the settings, submit your sitemap to Google Search Consoles and check out the internal linking. Though it’s not compulsory, it might save you from future problems.

Suppose you are facing any other issue in resolving the index.php error in WordPress URL. Do write in the comment section; we would love to assist you.

You should read

How to Change the Link color in Elementor With or without CSS Code

Till Next!

Social Media


1 Comment

  • как торговать , April 6, 2023

    Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

Leave a Reply

Your email address will not be published. Required fields are marked *