.htaccess for dummies

Paul B

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?

Code:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
 
I just checked my .htaccess file on my test site.. standard install and this is what is listed for mine:

Code:
<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]
</IfModule>

Do you use cPanel by chance?

Jamie
 
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:

Code:
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>

<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
 
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:
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?
 
Getting somewhere...

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

Code:
RewriteCond %{HTTP_HOST} ^www\.cliptheapex\.com
RewriteRule (.*) http://cliptheapex.com/$1 [R=301,L]
 
_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.
: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.
 
Top Bottom