Categories: eLearning

Remove .php and .html extensions from URL using htaccess

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.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Code to hide HTML Extension from URL:

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

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

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.

 

View Comments

  • I have been browsing online more than three hours today,
    yet I never found any interesting article like yours.
    It's pretty worth enough for me. Personally, if all website owners
    and bloggers made good content as you did,
    the web will be much more useful than ever before.

  • You really make it seem so easy with your presentation but
    I find this topic to be actually something which I think I would never understand.
    It seems too complicated and very broad for me.
    I am looking forward to your next post, I'll
    try to get the hang of it!

  • Thanks for your personal marvelous posting! I really enjoyed reading it, you may be a great author. I will make certain to bookmark your blog and will eventually come back in the future. I want to encourage you to ultimately continue your great posts, have a nice evening!

  • I am regular visitor, how are you everybody? This piece of writing posted at this web page is really nice.

  • I'd like to thank you for the efforts you have put in writing this website.

    I am hoping to view the same high-grade blog posts by you later on as well.
    In truth, your creative writing abilities has motivated me to get my
    own, personal website now ;)

Recent Posts

Mistakes of Entrepreneurs: Deadly Mistakes of Entrepreneurs

The mistakes of entrepreneurs can be one of the costliest mistakes. Not only it can cost your business, but it…

5 days ago

Top Young Entrepreneurs from India, you must know about

Today, We'll featuring top young entrepreneurs from India, who have actually inspired entrepreneurs across the world. India has one of…

1 week ago

नए उद्यम विकास को प्रभावित करने वाले कारक।

भारत में उद्यमिता विकास  को प्राभावित करने वाले कारण निम्न हैं। जैसे : -  आर्थिक, सामाजिक और सांस्कृतिक , मनोवैज्ञानिक,…

1 month ago

उद्यमियों (एंटरप्रेन्योर) के लिए कौन सी योजना उपलबध है

भारत सरकार ने हमेशा से ही उद्योग के क्षेत्र को बढ़ावा देने की कोशिश की है. देश में उद्यमियों की…

2 months ago

उद्यमियों ( एंटरप्रेन्योर ) के लिए वैश्विक समस्या क्या है

किसी भी देश में आर्थिक विकास की गति को बढ़ावा देने तथा व्यावसायिक समस्याओं का समाधान करने में उद्यमी की…

2 months ago

Cocofit Has Raised INR 5 Crores From Shark Tank India

The shark tank India startup Cocofit has raised an unconventional amount of 5 rupees for the equity of 5% from…

2 months ago

REACH US

WEXT India Ventures

C-22, Sector 65, Noida, Uttar Pradesh – 201301

Corporate Queries:

Email: ping@wext.in
Mobile: +91 956 085 0036

Advertisement Queries:

Email: advertise@wext.in
Mobile: 956 085 0036