Removing file extensions using htaccess

Removing file extensions using htaccess

  1. Log into your cPanel.
  2. Click on File Manager in cPanelFind the Files category and click on the File Manager icon.
  3. Show hidden files in settingsIn the top right hand corner, click on Settings. For the primary domain, click on the Web Root radio button. For addon domains, click on the dropdown and find your desired addon domain name. Be sure the checkbox next to Show Hidden Files is checked. Click the Save button to return to the main File Manager screen.
  4. Click on editYou should now be in the root folder of the domain you chose. Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option. If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.
  5. You are now in the text editor. As most sites are coded with either htm or php, we have include the code for both below.
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html
  6. Be sure to hit the Save Changes button in the upper right corner to save your new htaccess configuration. Your site should now display the address without the file extension.





Comments (6)

  • minecraft

    Hey there! This is my first visit to your blog!
    We are a collection of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done
    a outstanding job!

  • minecraft

    I really like reading through a post that can make men and women think.
    Also, thank you for allowing for me to comment!

  • minecraft

    Wow, superb blog layout! How long have you been blogging for?

    you make running a blog look easy. The entire look of your website is
    excellent, as smartly as the content!

  • minecraft

    I got this web site from my friend who informed me regarding this site and at the moment this
    time I am visiting this web page and reading very informative
    posts at this time.

  • minecraft

    At this time it sounds like WordPress is the best blogging platform available right now.
    (from what I’ve read) Is that what you’re using on your blog?

  • minecraft

    Hi there, this weekend is good in favor of me, for the reason that this point in time i am reading this wonderful educational article
    here at my house.

Leave a Reply