My .htaccess file

Discussion in 'Apache' started by goppss, Jan 18, 2010.

  1. #1
    Good Day,

    I am trying to get opinions on my .htaccess file as I don't have any idea what i'm doing. I have been searching the internet trying to improve my site, but i am wondering if i might be doing more harm than good.

    The following is the code i've placed in the file could it be causing any problems, or conflicts.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^example.com$ [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

    Options -Indexes


    Redirect 301 /comments/example.php http://www.example.com/dir/dir/dir/index.html




    # compress all text & html:
    AddOutputFilterByType DEFLATE text/html text/plain text/xml

    # Or, compress certain file types by extension:
    <FilesMatch "\.(php|html|js|css|flv)$">
    SetOutputFilter DEFLATE
    </FilesMatch>

    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Expires "Thu, 22 Apr 2010 20:00:00 GMT"
    </FilesMatch>






    RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR]
    RewriteCond %{QUERY_STRING} ^(.*)=http [NC]
    RewriteRule ^(.*)$ - [F,L]



    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
    RewriteRule ^(.*)index\.html$ http://%{HTTP_HOST}/$1 [R=301,L]



    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ http://%{HTTP_HOST}/$1 [R=301,L]
     
    goppss, Jan 18, 2010 IP