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

Changed URL. http://www.myboard works but http://myboard.com doesnt

Discussion in 'Troubleshooting and Problems' started by DRE, May 1, 2012.

  1. DRE

    DRE Well-Known Member

  2. DBA

    DBA Well-Known Member

    Do you not have a redirect setup in your .htaccess?
     
  3. DRE

    DRE Well-Known Member

    This is the only thing in my .htaccess.

    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
     
        #    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) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>

    I could've sworn I had way more stuff in there before. :eek:
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

  5. CyclingTribe

    CyclingTribe Well-Known Member

    What web server are you using, and do you have the non-www address aliased in your web server directive config?
     
  6. DRE

    DRE Well-Known Member

    I use urljet and they have lightspeed.

    http://xenforo.com/community/threads/htaccess-non-www-to-www.7105/

    I used this code just now right under 'rewrite on'

    Code:
        RewriteCond %{HTTP_HOST} ^url\.com [NC]
        RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L] 
    But I have several subdomains. What rewrite rules enforces www.url.com only? I need it to redirect from url.com to www.url.com
     
  7. CyclingTribe

    CyclingTribe Well-Known Member

    You can specify multiple domains and subs to rewrite to your www URL - give this example a try:

    Code:
    Options -Indexes +Includes
    
    #       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
    
    RewriteCond %{HTTP_HOST} ^www\.url\.net$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^sub\.url\.co\.uk$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^www\.url\.co\.uk$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^url\.net$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^other\.url\.net$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^different\.url\.net$ [NC]
    RewriteRule ^(.*)$ http://www.url.com/$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) - [NC,L]
            RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
    
    
     
  8. DRE

    DRE Well-Known Member

    okay great, do I change url with my actual url

    and i'm basically needing these rewrite rules for two different sites, one that is my main domain which is a myforum.com site

    and one of my subdomains, which is a myforum.net site. Do I use that code for the myforum.com site

    and when using the code for the myforum.net site just change the example so that its myforum.net?
     
  9. CyclingTribe

    CyclingTribe Well-Known Member

    Yes.

    Let's do it backwards - what is the destination URL - where you want all the requests to end up?
     
  10. DRE

    DRE Well-Known Member

    I have two domains. The main domain is www.the8thlegion.com

    That's working fine now except people can access the site through http://the8thlegion.com

    When they go to that url, they are logged out. It does not save their cookies.

    So It used to work both ways but it doesn't anymore.

    I want to force www.the8thlegion.com instead of letting people go to the site through http://the8thlegion.com


    Alright that's one issue.

    The other issue is the same as above except this one is called www.blackgamer.net and is a subdomain underneath the8thlegion.com
     
  11. CyclingTribe

    CyclingTribe Well-Known Member

    Cookies apply to the URL that someone logs in at - so if you login at "www.site.com" the cookie won't apply if you visit the site via "site.com".

    Anyway, for the8thlegion try this:

    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
     
            #      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 %{HTTP_HOST} ^the8thlegion\.com$ [NC]
    RewriteRule ^(.*)$ http://www.the8thlegion.com/$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) - [NC,L]
            RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
    
     
  12. CyclingTribe

    CyclingTribe Well-Known Member

    I don't understand this part - you can't have "www.blackgamer.net" as a sub-domain of the8thlegion.com - are you trying to redirect from one domain to the other?
     
    The8thLegion likes this.
  13. DBA

    DBA Well-Known Member

    A sub-domain would be like this

    subdomain.the8thlegion.com
     
    The8thLegion likes this.
  14. DRE

    DRE Well-Known Member

    Yup that's what it is. I got everything working now though thanks!
     
  15. DRE

    DRE Well-Known Member

  16. DRE

    DRE Well-Known Member

    This worked out great thanks! Also worked with this config edit

     

Share This Page