Remove .php and .html extensions from URL using htaccess

August 31, 2017
10 Shares 116 Views
Like
Like Love Haha Wow Sad Angry
12

All the time, Web Developer doesn’t want to show file extensions in URL like .html or .php

Now the main thing is how to hide .php and .html from URL without coding the lengthy program or using the complex method.To remove PHP and HTML from URL, use the .htaccess file. That’s the simple & quickest way to remove extensions from URL.

Related Blog: Force redirect to HTTPS using .htaccess file in PHP

Create .htacces File

To create the .htaccess file. Go to Root Directory of your project and create a new file named as .htaccess

Code to hide PHP Extension from URL:

To hide the PHP extension from the URL, paste the below code in your .htaccess file.

Code to hide HTML Extension from URL:

To hide the HTML extension from the URL, paste the below code in your .htaccess file.

After adding these lines of code, you can run your HTML/PHP files on browsers without extensions.
That’s all for Today. We’ll be coming soon with some interesting technical blog at WEXT.in Community.

Stay tuned with us at WEXT.in Community.

 

Like
Like Love Haha Wow Sad Angry
12

Comments

comments

Leave a Comment

Your email address will not be published.