XF 1.2 Site domain not working unless site.tld/forum/

@Brogan

# 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

# 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

# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
That's the standard XenForo htaccess. And that's at the root of your domain?

It looks like you've installed XF into /forum, so anything that's outside of that shouldn't be involved with XF. (Presumably you are trying to redirect to /forum/index.php?)
 
That's the standard XenForo htaccess. And that's at the root of your domain?

It looks like you've installed XF into /forum, so anything that's outside of that shouldn't be involved with XF. (Presumably you are trying to redirect to /forum/index.php?)

I don't really know what you mean by "root of your domain". The file I pasted was located at /var/www/forum/ and there isn't one at /var/www/ (which I think is the root of my domain?). I'm trying to redirect to /forum/index.php?portal/ actually, but yeah same thing :P It worked fine on my old VPS, which confuses me why it doesn't work now.
 
Do you have anything in the /var/www directory? If not, are you planning on putting a static page there or WordPress? If not, any particular reason why you placed it in /var/www/forums?
 
What is the htaccess you have in your root (/var/www) directory. Odds are that is where the problem lay (and not with the .htaccess in the /var/www/forum - which you may need to uncomment the ReWriteBase on and replace /xenforo with /forum).
If you don't have a .htaccesss in your root then what you are seeing is the expected behavior if your vhost definition points the domain at the /var/www folder. You can do a rewrite in the root htaccess to redirect all inbound traffic to the /forum folder.
 
@Tracy Perry I put the .htaccess file in my root directory and uncommented the ReWriteBase line and replaced it to /forum. I'm still getting the error, so I'm assuming I have to do more still? Also in my /forum/ directory I still have the default htaccess file.
 
@Tracy Perry I put the .htaccess file in my root directory and uncommented the ReWriteBase line and replaced it to /forum. I'm still getting the error, so I'm assuming I have to do more still? Also in my /forum/ directory I still have the default htaccess file.
You don't put that one in your root one - only in your /forum one.
As I said, it is expected behavior if your forum is not your http://mydomain.com root directory. It will default to displaying whatever is in /var/www (which is probably your root for the vhost) and you have to have either a page there with a link to it or have an htaccess written to redirect all incoming traffic to the /var/www/forum directory and then have links back to whatever the pages are in your /var/www directory.
Are you using Apache2 or nginx. Can you post your related vhost definition (or is this a shared hosting environment?).
 
@Tracy Perry Apache2. Sorry, I don't know what a vhost definition. If you haven't noticed, I'm an absolute amateur at this stuff. :p
Virtual Host - the definition for your site for apache to know where to go to find the goodies it needs.
allows multiple sites to be hosted by one apache installation (like on one of my servers I have 7 sites hosted there).
It's usually somewhere under /etc/httpd/conf if I remember correctly.
It could be one file containing multiple definitions that look similar to
Code:
# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com

# Other directives here

</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org

# Other directives here

</VirtualHost>
or it could be multiple individual vhost config files (which is what I do under nginx).
Depending on which OS you are using it could be in different areas.
http://wiki.apache.org/httpd/DistrosDefaultLayout

Is this a shared hosting provider (which will limit what you can do) or a VPS/dedicated server?
 
@Tracy Perry It's a VPS, and thanks I found it

Code:
<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
 
OK, your root is /var/www, so now the question is... are you wanting anyone who goes to hossfactions.com to automatically route to the forum or do you have an index page being served from the root (an index.html, index.php, index.htm)?
If you are wanting them to go directly to the forum, then you need to do an .htaccess with a redirect placed in your /var/www directory to route them to /var/www/forum when they arrive.

You can try the below in the .htaccess and see if that works.

Code:
RewriteEngine On
RewriteRule ^$ /forum [L]

The problem will be you will also need to decide if you want to re-route all WWW requests to the base domain (stripping the WWW) or vice-versa.
 
OK, your root is /var/www, so now the question is... are you wanting anyone who goes to hossfactions.com to automatically route to the forum or do you have an index page being served from the root (an index.html, index.php, index.htm)?
If you are wanting them to go directly to the forum, then you need to do an .htaccess with a redirect placed in your /var/www directory to route them to /var/www/forum when they arrive.

You can try the below in the .htaccess and see if that works.

Code:
RewriteEngine On
RewriteRule ^$ /forum [L]

The problem will be you will also need to decide if you want to re-route all WWW requests to the base domain (stripping the WWW) or vice-versa.
I just want to have hossfactions.com take me to /forum/index.php?portal/ because I use xenporta
 
Last edited:
If you are using the built in routes, you just need it to take you to hossfactions.com/forum, which the supplied .htaccess code in your /var/www/.htaccess should do.
I thought you told me to put the .htaccess in /forum/ not in the root? Anyways... should I just add
Code:
RewriteRule ^$ /forum [L]
to .htaccess in my root directory and I should be good to go?
 
Have you got cPanel?

If you do:
Domains > Redirects


www. redirection: Only redirect with www. Redirect with or without www. Do Not Redirect www.
 
Back
Top Bottom