.htaccess file

Discussion in 'Site & Server Administration' started by cnjai20, Nov 14, 2011.

  1. #1
    Hello all,

    What are the uses of .htaccess file ?

    Right now i am using .htaccess file for url redirection - "canonical issue salvation"

    I need to remove the .html ext from my website url. For that i need .htaccess code , could any one help me
     
    cnjai20, Nov 14, 2011 IP
  2. mihaidamianov

    mihaidamianov Well-Known Member

    Messages:
    1,434
    Likes Received:
    111
    Best Answers:
    0
    Trophy Points:
    190
    #2
    Post more details, such as the content of your current htaccess file.
     
    mihaidamianov, Nov 14, 2011 IP
  3. cnjai20

    cnjai20 Well-Known Member

    Messages:
    179
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine on
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !mywebsite.com
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^([^\.]+)$ http://mywebsite.com/$1.html [NC,L]
     
    cnjai20, Nov 14, 2011 IP
  4. mihaidamianov

    mihaidamianov Well-Known Member

    Messages:
    1,434
    Likes Received:
    111
    Best Answers:
    0
    Trophy Points:
    190
    #4
    I think you just need to remove the .html on the bottom line, like this:

    RewriteRule ^([^\.]+)$ http://mywebsite.com/$1 [NC,L]

    However, all your links on your website will have to point to the new urls, without .html. That has to be done manually and with care in the source.
     
    mihaidamianov, Nov 15, 2011 IP