How to remove file extensions from URLs

Asked by:
genegun
Time:
2012-02-12 9:25 am
Category:
Htaccess
Hits:
1,349
Hi,

I tried to get the .htaccess file to redirect http://www.example/page.html to http://www.example/page with the following code:

RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*)\.html$ $1 [R=301,L]

now the redirect does remove the ".html" BUT it yields to an url like: http://www.example/home/myaccount/public_html/page

How can I set this redirect so it does not add the "/home/myaccount/public_html/" bit?

Thank you

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by Web Hosting Hub staff

0

ChristiNi
2012-02-13 2:32 pm
Hello genegun,

Thank you for your question about removing the file extension from your site's URLs. You can use the following code in your .htaccess file to use URLs like http://www.example/page or http://www.example/page/ instead of http://www.example/page.html:

Options +MultiViews

Please make sure you remove the previous code from the .htaccess file.

If you have any additional questions or need further assistance, please do not hesitate to contact us.

Regards,

Christi N.

You must login before you can post a comment about this answer.

Like this Question?

Have a Question?

If you need some help, submit your question to our Community! We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)

Recent Questions

  1. Email from unknown party re domain transfer
  2. how to make new website with single account.
  3. Internal Server Error

Support Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.