How to Remove index.php from WordPress URL: A Step-by-Step Guide

Spread the love

Introduction


Hello Guys, let’s learn how to remove index.php from WordPress URL.

If you’re running a WordPress website, you might have noticed that sometimes your URLs contain “index.php“. Not only does it make your URLs look less clean, but it can also affect your site’s SEO. Fortunately, there’s a simple solution – removing “index.php” from your WordPress URLs. In this guide, we’ll walk you through the process step-by-step, making it easy for even beginners to follow along.

Step 1: Access Your WordPress Dashboard

Log in to your WordPress dashboard using your administrator credentials. Once logged in, navigate to the “Settings” tab on the left-hand side and click on “Permalinks“. This is where you’ll make the necessary changes to your URL structure.

Also read: How to use Multiple Laravel sail project with Custom Domain

image How to Remove index.php from WordPress URL: A Step-by-Step Guide

Step 2: Choose a Custom Permalink Structure

In the Permalinks settings, you’ll see several options for permalink structures. By default, WordPress might have “Plain” selected, which includes “index.php” in the URLs. Choose the “Custom Structure” option and enter the following into the text field: "/%postname%/". This will remove “index.php” from your URLs and make them more SEO-friendly.

Also read: How to Extract Text from a PDF File in Laravel?

image 1 How to Remove index.php from WordPress URL: A Step-by-Step Guide

Step 3: Save Changes and Test Your Website

After entering the custom permalink structure, scroll down and click on the “Save Changes” button to apply the new settings. Once saved, visit your website and navigate to different pages to ensure that the URLs are now clean and free of “index.php“. Test various links to make sure everything is working as expected.

Also read: How to Word limit of a string in Laravel?

image 2 How to Remove index.php from WordPress URL: A Step-by-Step Guide

Step 4: Update Your .htaccess File (Optional) for advanced user

In some cases, especially if you’re using a custom WordPress installation or a non-standard server configuration, you might need to manually update your .htaccess file to remove “index.php” from URLs. To do this, access your website’s root directory using an FTP client or file manager provided by your hosting provider. Locate the .htaccess file and add the following code:

Also read: How to integrate LINKEDIN LOGIN in Laravel 10

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

Save the changes to your .htaccess file and upload it back to your server. This code will ensure that requests to “index.php” are redirected to the root URL without “index.php“.

Also read: How to block specific email domains from registering in Laravel

Conclusion:

By following these simple steps, you can easily remove “index.php” from your WordPress URLs, making them cleaner and more SEO-friendly. Remember to always backup your website before making any changes and test thoroughly to ensure everything is functioning correctly. With clean URLs, you’ll not only improve the user experience but also boost your site’s search engine rankings.

Leave a Comment