logo
  • Home
  • About
  • Services
  • Portfolio
  • Contact Us
  • Submit Guest post
remove or change php html extensions using htaccess file

How to remove or change .php, .html extensions using .htaccess file

March 25, 2016 No comments Article SEO Website Designing

Hi Friends, Today i will tell you how to remove or change php html extensions using  htaccess file. It is so easy and simple, but we need to remove the extension like .php or .html. It helps to covert your url to SEO friendly url.

URL: http://www.website.com/user.php or http://www.website.com/user.html
SEO Friendly URL: http://www.website.com/user or http://www.website.com/user

If you want to use SEO friendly URL for your website then it is important to remove special characters and extensions from the url.

How to remove or change php html extensions using htaccess file:

You have to follow some steps to remove or change php html extensions using htaccess file. These steps are

Steps1: You have to create a .htaccess file in the root folder and write some code like

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
</IfModule>

Step2: Most of the time it is already created named htaccess.txt, Change the name of this file .htaccess. and check in the php.ini file your mod_rewrite should be enabled.




Step3: Now you have to know how to remove the extensions after creating the file. Write these code.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# Remove .php extension from url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# Remove .html extension from url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
</IfModule>

Step5: Now Check the URL of your website.

Before placing the code
http://www.website.com/user.php
http://www.website.com/user.html

After Placing the code
http://www.website.com/user

Step6: Now Enjoy your website without extension like .php or .html

How to remove or change php html extensions with slash using htaccess file:

If you want a slash after your URL like http://www.website.com/user/
Follow the below steps.

Step1: Create .htaccess file in the root folder.




Step2: Place the below code in the .htaccess file and add it between
<IfModule mod_rewrite.c> and </IfModule>

# Add slash at end of the url
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ $1/ [R=301,L]
 

Step3: Check your URL after applying the code.

Before placing the code
http://www.website.com/user.php
http://www.website.com/user.html

After Placing the code
http://www.website.com/user/

Step4: Enjoy your Website without extension .php or .html with slash.

NOW YOU KNOW HOW TO REMOVE OR CHANGE PHP HTML EXTENSIONS USING HTACCESS FILE

Read About Other Interesting Things below.

  1. HOW TO WRITE CSS CODE FOR SAFARI BROWSER ONLY (NOT CHROME)
  2. ADD GOOGLE CUSTOM SEARCH ENGINE ON YOUR WEBSITE
  3. DISABLE ADDING NOODP META ROBOTS TAG IN YOAST PLUGIN
  4. Basics of Social Media Optimization Services
  5. On Page Search Optimization Services
  6. How to Create a Website from scratch for beginners
  7. How To Write a Blog for Website and Content Marketing
  8. Website Promotion – Need For All Websites
  9. Important Things to Think Before Graphic Designs
  10. Remember Things Before Email Marketing

Share this:

  • Tweet
  • Telegram
  • WhatsApp
  • Share on Tumblr
  • Pocket
  • Email

Related

Categories: Social Media Optimization

Tags: change php html extensions using htaccess file, how to remove or change php html extensions using htaccess file, remove extensions using htaccess file, remove or change php html extensions using htaccess file, remove php html extensions using htaccess file

Leave a Reply Cancel reply

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,504 other subscribers

Categories

  • Angular (1)
  • Content Marketing (2)
  • Email Marketing (3)
  • Graphics Design (3)
  • Keyword Strategy (1)
  • Other (3)
  • Search Engine Optimization (10)
  • Social Media Optimization (4)
  • Website Design (67)
  • WordPress (18)
  • Subscribe to Blog via Email

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,504 other subscribers

  • Tag Cloud

    Add Social Share button in WordPress without Plugins Bootstrap center div on screen with flexbox center div vertically and horizontally in body center div vertically and horizontally responsive Center Elements Vertically And Horizontally Using Flex Centering in CSS Create Your Own Fast Social Sharing Buttons For WordPress Creating Scroll-based Animations using jQuery and CSS3 CSS CSS3 CSS3 Variables CSS custom properties CSS Variables custom share buttons wordpress Disable Mouse Right Click Using Jquery disable right click with jquery Disabling right mouse click menu facebook Get to Know the CSS Object Fit and Position Properties How Can You Use CSS Variables HOW TO CODE A RESPONSIVE EMAILER OR NEWSLETTER How to Create Social Sharing Button without any Plugin HOW TO DESIGN A RESPONSIVE EMAILER OR NEWSLETTER how to disable right click menu in html page How to prevent Right Click option using jquery How to Restore WordPress Website from Backup Manually How to use CSS Variables HTML HTML5 javascript jquery jQuery make div slide in when scrolling down page Know About CSS Object Fit and Position Properties Meta Tags Mysql object-fit object-fit/object-position object-position Responsive Website Sliding Div When Scroll Down Page Using Jquery Vertical Centering - Solved by Flexbox Webpage Scrolling Animation Effects with CSS3 & jQuery What You Need To Know About CSS Variables wordpress
  • Copyright SEO Website Designing 2015

    loading Cancel
    Post was not sent - check your email addresses!
    Email check failed, please try again
    Sorry, your blog cannot share posts by email.