Remove index.php or index.html from URL or Website

How to remove index.php or index.html from URL or website easily

Remove index.php or index.html from URL or Website

Start From Here ( 5 MINS READ TIME )

Add The following code in .htaccess file to remove (index.php or index.html) from URL or Website Easily

Example if your website is opening  like this :

"https://www.yourwebsite.com/index.html"  or  "https://yourwebsite.com/index.html"  or "www.yourwebsite.com/index.html"

or

"https://www.yourwebsite.com/index.php"  or  "https://yourwebsite.com/index.php"  or "www.yourwebsite.com/index.php"

& you want to remove  index.html /index.php link from URL & Website then add below code in your site's root .htaccess file:

RewriteCond %{REQUEST_URI} !/$ [NC]

RewriteCond %{REQUEST_URI} /index.(html?|php)$ [NC]

RewriteRule .* http://example.com/ [R=301,L]

After adding your website will look like: (example)

"https://www.yourwebsite.com"  or  "https://yourwebsite.com"  or "www.yourwebsite.com"

Note: Replace “yourwebsite.com” with your actual  or your domain name wherever required.

Note: Backup your current .htaccess file and then add these rules.

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0