1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess for dummies

Discussion in 'XenForo Questions and Support' started by Brogan, Nov 1, 2010.

  1. Brogan

    Brogan XenForo Moderator Staff Member

    I'm sure I'm not the only one who looks at the .htaccess file and thinks "What the...hell?"

    I've searched on the net and asked my host for help but I'm still struggling to understand what some of the entries do.

    So in attempt to get to the bottom of all the various entries in my .htaccess file, I thought I'd ask here.

    First up is this one; what's it for and is it required with a XenForo installation?

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    Trombones13 likes this.
  2. Jamie

    Jamie Well-Known Member


    It would seem that Indexignore is telling it to hide a list of fileswhen listing a directory.

    So I guess it would hide files in the /header /readme and /_vti* directories... since these don't exist in a standard xF install I wouldn't think it would be needed.. but I only searched and found this inf0rmation, I am somewhat clueless to these things..

  3. Blandt

    Blandt Well-Known Member

    That line disable directory listing in case there is no index.php in a given folder
  4. Jamie

    Jamie Well-Known Member

    I just checked my .htaccess file on my test site.. standard install and this is what is listed for mine:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data|js|styles|install) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    Do you use cPanel by chance?

  5. Brogan

    Brogan XenForo Moderator Staff Member

    I should clarify that this is from the .htaccess file for my current site.

    There's quite a lot in there so I just need to know what bits to keep when I migrate to XF, if any.
    The standard XenForo .htaccess file has none of the existing entries so I'm just trying to determine whether any of them are needed.
    Like this:

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    <Limit PUT DELETE>
    order deny,allow
    deny from all
  6. Brogan

    Brogan XenForo Moderator Staff Member

    There are quite a few directories without index.php in the XenForo installation so why isn't it required?
  7. Blandt

    Blandt Well-Known Member

    This line disable direct request to those folders (data,js,styles,install)

    RewriteRule ^(data|js|styles|install) - [NC,L]
  8. Brogan

    Brogan XenForo Moderator Staff Member

    I have finally got my .htaccess sorted and fixed all the problems I was having with 403 errors.

    Now I'm trying to implement the non-www but it's not working.
    Im using this code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^cliptheapex\.com$
    RewriteRule ^(.*)$ [URL]http://cliptheapex.com$1[/URL] [R=301,L]
    But instead of http://cliptheapex.com/home.php loading, it's trying to load http://cliptheapex.comhome.php - no backslash between com and home.

    Can anyone tell me what's wrong with the rewrite string?
    anotheralias likes this.
  9. anotheralias

    anotheralias Well-Known Member

    I've been putting off tackling that - thanks for asking about it!
  10. Brogan

    Brogan XenForo Moderator Staff Member

    Getting somewhere...

    This works for everything but the home page which gives me a "too many redirects" error:

    RewriteCond %{HTTP_HOST} ^www\.cliptheapex\.com
    RewriteRule (.*) http://cliptheapex.com/$1 [R=301,L]
  11. anotheralias

    anotheralias Well-Known Member

    I'm gonna need a bigger boat. :/
  12. mjp

    mjp Well-Known Member

    _vti is part of the FrontPage [shudder] file system. Maybe FrontPage created that line, in which case it should be deleted, then burned, then buried under 40 feet of concrete so you're sure it's dead.
    Brogan likes this.
  13. Brogan

    Brogan XenForo Moderator Staff Member

    :D I removed that earlier today.
    For some reason it keeps getting added back in, possibly due to certain actions carried out in cPanel?

    Anyway, my .htaccess has been reduced from about 30 lines of code to 5.
  14. mjp

    mjp Well-Known Member

    Oh yeah, if it's cPanel and your default site "skeleton" has FP enabled it will keep adding that back.

Share This Page