0

I was trying to make a redirect address like http://lorem.com/contact/ for contact.html file,which is in root folder. Is there any tool or file to do this?

I had tried renaming contact.html into index.html, and then put it unde /contact folder. It worked, as a address http://lorem.com/contact/, but I think this is not a proper way to do.

(Note: Title might be weird, for not knowing what keywords to describe this. Any help of editing is appreciated.)

chenghuayang
  • 1,424
  • 1
  • 17
  • 35

1 Answers1

0

With .htaccess under apache you can do the redirect like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301] 

As for removing of .html from the url, simply link to the page without .html

page

Source: How to remove .html from URL

Community
  • 1
  • 1
Ayush
  • 311
  • 1
  • 10