Want clean, professional, and SEO-friendly URLs for your website? In this step-by-step tutorial, you'll learn how to remove .html and .php extensions from your URLs using the .htaccess file.
This method works on Apache servers and helps improve user experience, URL readability, and search engine optimization.
🔧 In This Video, You'll Learn:
What .htaccess is and how it works
How to remove .html and .php extensions
How to redirect old URLs to new ones properly
Common mistakes to avoid
💻 Code Used:
RewriteEngine On
👉 Remove .php extension .htaccess code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php-f
RewriteRule ^(.*)$ $1.php
👉 Remove .html extension .htaccess code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
🚀 Benefits of Clean URLs:
✔ Better SEO rankings
✔ Improved user experience
✔ Cleaner and more professional links
📌 Example:
Before:
👉 yourwebsite.com/page.php
👉 yourwebsite.com/about.html
After:
👉 yourwebsite.com/page
👉 yourwebsite.com/about
Social Links:-
Website : https://www.stilllearning.in
YouTube : / @stilllearning
Facebook : / stilllearning.in
Twitter : / stilllearningin
🔥 Don’t forget to Like 👍, Share 🔁, and Subscribe 🔔 for more CSS animations, web design tutorials, and creative coding tips!
#removehtmlextension #removephpextension #htaccess #seofriendlyurls