How To Remove Index.php From URL In Your WordPress

How To Remove Index.php From URL In WordPress



When it comes to creating clean and user-friendly URLs for your WordPress website, removing the “index.php” portion can significantly enhance the overall aesthetic and SEO-friendliness of your site.

The “index.php” in the URL is a default file that WordPress uses as the main template for displaying your website’s content.

However, having it appear in your URLs can make them longer and less memorable, potentially affecting your site’s search engine rankings and user experience.

Fortunately, WordPress provides a straightforward method to remove the “index.php” from your URLs, making them shorter, more concise, and easier to remember.

By eliminating this unnecessary part of the URL structure, you can enhance the overall appearance of your website’s links and improve your SEO efforts.

In this guide, we will explore the steps required to remove “index.php” from the URLs of your WordPress website.

How Do I Remove index.php from URL in Your WordPress Website?

 By removing unnecessary elements, such as “index.php,” from your URLs, you can create concise, memorable links that enhance both the visual appeal and search engine optimization (SEO) of your site. 

Fortunately, WordPress offers simple methods to remove “index.php” from your URLs, resulting in cleaner and more effective website addresses.

In this article, we will explore step-by-step instructions on how to remove “index.php” from the URLs of your WordPress website. 

By following these techniques, you can create streamlined URLs that improve user experience, increase click-through rates, and boost your site’s search engine visibility.

Method 1: Configure Permalink Settings.

  • Log in to your WordPress admin dashboard.
  • Navigate to “Settings” and select “Permalinks.”
  • Choose the “Post name” option or any other preferred permalink structure that doesn’t include “index.php.”
  • Save the changes.

WordPress will automatically update your website’s permalink structure, removing “index.php” from the URLs of your posts and pages. 

However, this method relies on your server environment’s compatibility with WordPress’s URL rewriting capabilities.

Method 2: Modify the .htaccess File.

  • Connect to your website’s server using FTP or a file manager provided by your hosting provider.
  • Locate the .htaccess file in your WordPress website’s root directory.
  • Download a backup copy of the .htaccess file to ensure you can revert changes if necessary.
  • Open the .htaccess file using a text editor.
  • Add the following code snippet at the beginning of the file:


   <IfModule mod_rewrite.c>

   RewriteEngine On

   RewriteBase /

   RewriteRule ^index\.php$ - [L]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule . /index.php [L]



6. Save the changes and upload the modified .htaccess file back to your server, replacing the original file.

This method utilizes Apache’s mod_rewrite module to rewrite URLs, effectively removing “index.php” from your WordPress website’s links.

It provides a more robust solution for removing “index.php” from URLs, even in cases where the permalink settings may not be effective.

Method 3: Consult with Your Hosting Provider

If the above methods do not work or you are unsure about modifying the .htaccess file, it’s recommended to reach out to your hosting provider for assistance. 

They can guide you on the best approach to remove “index.php” from URLs based on your server environment and specific hosting configuration.


Removing “index.php” from the URLs of your WordPress website offers several benefits, including improved aesthetics, enhanced user experience, and better search engine optimization. 

By following the methods outlined in this article, you can easily achieve cleaner and more effective URL structures in your WordPress site.

Remember to choose the permalink structure that suits your website’s needs and check for compatibility with your server environment. 

Additionally, always back up your files before making any modifications to ensure you can revert changes if required.

By implementing these techniques and creating concise, user-friendly URLs, you can optimize your WordPress website for better visibility, engagement, and overall success.

What do you think?

Written by Udemezue John

Hello, I'm Udemezue John, a web developer and digital marketer with a passion for financial literacy.

I have always been drawn to the intersection of technology and business, and I believe that the internet offers endless opportunities for entrepreneurs and individuals alike to improve their financial well-being.

You can connect with me on Twitter


Leave a Reply

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

GIPHY App Key not set. Please check settings



    How To Reduce Initial Server Response Time In WordPress


    How To Remove Malware From WordPress Site