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

.htaccess help

Slavik

XenForo moderator
Staff member
#2
Try this.

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
 
F

Floris

Guest
#5
This is what I use on XenFans, which seems to work

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^xenfans.com$ [NC]
RewriteRule ^(.*)$ http://xenfans.com/$1 [L,R=301]

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>
 

sparky5693

Active member
#6
Nope, that didn't do it either. Lemme be sure, this goes into the root directory of the server, not in the folder containing xenforo, yes?

I've tried both explorer and firefox, even cleared my cache just to be sure.
 
F

Floris

Guest
#7
If you have your upload/* from xenforo, that's where it goes.
so when you view the dir, you have xenforo's index.php a dir called library/ and a few other things, and .. the .htaccess one.
 

sparky5693

Active member
#8
Well that makes all the difference then. I've been placing this just inside the publichtml folder, while the forum is installed inside /forums. Do I edit this into the xenforo htaccess file, or would this replace it entirely?
 
#12
RewriteCond %{HTTP_HOST} !^xenfans.com/forums/$ [NC]
RewriteRule ^(.*)$ http://xenfans.com/forums/$1 [L,R=301]
I used this, and it knocked the website offline.
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^theshaveden.com/forums$ [NC]
RewriteRule ^(.*)$ http://theshaveden.com/forums/$1 [L,R=301]

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>
 

CyclingTribe

Well-known member
#14
I used this, and it knocked the website offline.
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^theshaveden.com/forums$ [NC]
RewriteRule ^(.*)$ http://theshaveden.com/forums/$1 [L,R=301]

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>
You've missed the ending slash from the second line:

RewriteEngine On RewriteCond %{HTTP_HOST} !^theshaveden.com/forums/$ [NC]

Cheers,
Shaun :D
 
#15
Yup... I certainly did. Unfortunately, it didn't help. When I use the code below, the forum won't even load.
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^theshaveden.com/forums/$ [NC]
RewriteRule ^(.*)$ http://theshaveden.com/forums/$1 [L,R=301]

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>
 

Jake Bunce

XenForo moderator
Staff member
#16
I know this code works. Just modify it to specify your domain. Try this code:

Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www.theshaveden.com/forums$ [NC]
    RewriteRule ^(.*)$ http://theshaveden.com/forums/$1 [R=301,L]

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    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>
 
#17
I know this code works. Just modify it to specify your domain. Try this code:

Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www.theshaveden.com/forums$ [NC]
    RewriteRule ^(.*)$ http://theshaveden.com/forums/$1 [R=301,L]

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    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>
Isn't working at all in firefox (manually cleared cache). In explorer, it's not removing the www, but it is maintaining my login info across www and non www. I feel like i'm missing something incredibly simple here.