Redirecting www to root domain - best practice?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • r5a
    New Member
    • Jul 2017
    • 5
    • 5.3.x

    Redirecting www to root domain - best practice?

    Am I understanding correctly that vBulletin is coded to run only from 1 URL that you set in the Admin CP?

    With that being said whats the best way to do a redirect, .htaccess with a rewrite rule or some other method? CNAME?

    Everything seems to be running fine on my forum. It's just a page refresh has to happen for things to be perfect.

    Can anyone see if my settings seem off here?

    My forum is in the root of the web server

    My vBulletin URL: https://domain.com
    Login URL: https://domain.com
    Core URL: https://domain.com/core
    Always use Forum URL as Base Path - No

    Redirection whitelist
    https://www.domain.com
    http://www.domain.com

    Path to Save Cookies: /
    Cookie Domain: (blank)

    What seems to happen going to https://domain.com - everything seems to work fine
    Going to https://www.domain.com - page loads fine but logins dont work, redirects back to the login and on the 2nd attempt I get a system error.

    I feel like I'm missing something so minor and overthinking/overlooking something simple just not sure what it is...

    Server is running 5.3.1
    Last edited by r5a; Wed 19 Jul '17, 9:07am. Reason: Added vBulletin V
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 74132

    #2
    The best practice is to control this in the virtual host directives of your server. However, if you don't have access to this, then you will need to edit your .htaccess (Apache) or web.config (IIS) file. All of your addon or parked domains should redirect to the one where vBulletin is told it is installed. Modern Browsers do not allow cookies to be shared among domains under any circumstance. They will even consider http://domain.com to be a completely different site from http://www.domain.com.

    You should leave the cookie path and cookie domain set to their defaults. They should only be used if you have multiple vBulletin installations on the same domain. Even then, it is easier to manage by simply changing the cookie prefix in your config.php files.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • r5a
      New Member
      • Jul 2017
      • 5
      • 5.3.x

      #3
      Originally posted by Wayne Luke
      The best practice is to control this in the virtual host directives of your server. However, if you don't have access to this, then you will need to edit your .htaccess (Apache) or web.config (IIS) file. All of your addon or parked domains should redirect to the one where vBulletin is told it is installed. Modern Browsers do not allow cookies to be shared among domains under any circumstance. They will even consider http://domain.com to be a completely different site from http://www.domain.com.

      You should leave the cookie path and cookie domain set to their defaults. They should only be used if you have multiple vBulletin installations on the same domain. Even then, it is easier to manage by simply changing the cookie prefix in your config.php files.
      Thanks Wayne. I have full access to everything. I did a bit of searching on this forum and reading around. I modified my .htaccess that comes with the vBulletin zip and just added

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

      Seems to be working fine. I'll do some further testing unless you see any issues with the above?

      Also, I have set
      cgi.fix_pathinfo = 0 in my php.ini - this shouldn't case any issues with VB right?

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 74132

        #4
        .htaccess rule looks fine.

        For cgi.fix_pathinfo, are you running Fast CGI? e.g. php-cgi as the PHP handler. If you're running php-mod or php-fpm then it won't have any affect. However, if it is working with the current settings, then you should just leave it be. I suggest only changing it if you're told to do so by your server administrator.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • r5a
          New Member
          • Jul 2017
          • 5
          • 5.3.x

          #5
          Originally posted by Wayne Luke
          .htaccess rule looks fine.

          For cgi.fix_pathinfo, are you running Fast CGI? e.g. php-cgi as the PHP handler. If you're running php-mod or php-fpm then it won't have any affect. However, if it is working with the current settings, then you should just leave it be. I suggest only changing it if you're told to do so by your server administrator.
          I am the server admin :X

          Looks like Apache is loading PHP as .so module so running as mod_php, Not to mention the phpinfo() tells me as much with the API showing: Apache 2.0 Handler.

          I think I'm going to switch the server config around and use FastCGI with sockets as it appears in the Apache documentation this is the preferred way to do it.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...