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

XF 1.5 .htaccess redirect

Discussion in 'Installation, Upgrade, and Import Support' started by ncbetz, Jun 23, 2016.

  1. ncbetz

    ncbetz Formerly Noah Betz

    This is what I have currently:
    #    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
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 405 default
    ErrorDocument 406 default
    ErrorDocument 500 default
    ErrorDocument 501 default
    ErrorDocument 503 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 %{HTTP_HOST} !^www\.libertyunderground\.org$ [NC]
        RewriteRule ^(.*)$ http://www.libertyunderground.org/$1 [R=301,L] 
        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]
    It redirects to "www", but I want it to redirect FROM www to without www. What changes need to be made?
  2. andybond

    andybond Active Member

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  3. ncbetz

    ncbetz Formerly Noah Betz

    Just to clarify,you said "RewriteBase /", but I have "RewriteBase /xenforo"
  4. andybond

    andybond Active Member

    Yours is # marked , therefore removed from the .htaccess.
  5. ncbetz

    ncbetz Formerly Noah Betz

    Is that fine?
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's fine. The # means it's commented which is the default. RewriteBase is normally not needed.
    Samet Chan and andybond like this.

Share This Page