Join the community today
Become a Member

vBulletin Problem With Redirect loop

Discussion in 'Forum software usage' started by Cr0w, Apr 5, 2015.

  1. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    hi , i installed VBulltien 4.4.2 Patch Level 4 + Dragon Byte Seo 1.4.7
    And i have some redirect problems in some pages


    in DBSEO I have re write urls see below
    Code:
    showgroups.php ==> staff.html
    click here and see the redirect loop error
    Code:
    http://forums.mashtyha.com/staff.html
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    If you're rewriting to .html extension files so that PHP services .html files, you need to tell Nginx not to serve .html files (performance wise not ideal so generally best to not rewrite to using .html extensions for php files).

    But if you don't care for slower performance and need to use .html rewrites, then tell Nginx not to serve .html files by editing /usr/local/nginx/conf/staticfiles.conf (can use command short cut to access file = statfilesinc)

    and comment out this part for .html file location match with hash in front of the lines
    Code:
        #location ~* \.(html|htm|txt)$ {
            #add_header Pragma public;
            #add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            #access_log off;
            #expires 1d;
            #break;
            #}
    then restart Nginx server
    Code:
    service nginx restart
    
    or use command shortcut
    Code:
    ngxrestart
     
    Last edited: Apr 5, 2015
  3. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    thanks , you are my man :D . so you suggest not redirect php files to html ?
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah .html should be left to nginx serving. I'd redirect to friendly urls without any extension at all. Just look at this very forum's urls
     
  5. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    should i add # to comment those rules ?
    if i do that whats happening is't bad options ?
    i want to change php urls to html :D thats seo suggest from Dragon Byte community
     
  6. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
  7. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    up to you whether to use .html, I personally never rewrite to .html extension files for performance reasons

    what's your full Nginx vhost domain.com.conf contents ? post in CODE tags
     
  8. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name forums.mashtyha.com;
    #            return 301 $scheme://www.forums.mashtyha.com$request_uri;
    #       }
    
    server {
      server_name forums.mashtyha.com ;
    
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/forums.mashtyha.com/log/access.log combined bu$
      error_log /home/nginx/domains/forums.mashtyha.com/log/error.log;
    
      root /home/nginx/domains/forums.mashtyha.com/public;
    
      location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      # More example Nginx vhost configurations at
      # http://centminmod.com/nginx_configure.html
        try_files $uri $uri/ /dbseo.php;
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /home/nginx/domains/forums.mashtyha.com/public/nginx.conf;
    
      rewrite ^/((archive/)?(.*\.php(/.*)?))$ /dbseo.php break;
      if (!-e $request_filename){
      rewrite ^(.+)$ /dbseo.php break;
    }
    
    here is ;)

    why ? :S
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    why, because my number 1 priority is performance and speed so don't need PHP handling .html files.

    There's your problem similar to Nginx and vBulletin vBSEO

    Code:
        try_files $uri $uri/ /dbseo.php;
    should be

    Code:
       try_files $uri $uri/ /dbseo.php?$args;
     
  10. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    vbseo developers has stoped Supporting that plugin , all webmasters was finding for any plugins for seo
    i found good one named DBSEO ;)

    Im don't want change php to html for optimzing speed ! i just wanna make change at my ugly urls ;)

    nothing was changed the problem still there :D
    The page isn't redirecting properly ,
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    did you restart nginx after changes i suggested ?
     
  12. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
  13. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  14. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    i know but maybe you can convert those codes or maybe found some rules to add on nginx
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nginx rewrites generally left to end user as Centmin Mod is provided as is so best to ask DBSEO authors as well :)

    checking against vbseo version you might be missing this line though

    Code:
    location ~ /(.*\.php)$ {
    rewrite ^/(.*)$ /dbseo.php last;
    }
    
    but definitely check with DBSEO developers
     
  16. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    they can't give service to our country :(

    nothing was changed still have error :((

    maybe the problem is from fastcgi_params
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh i just noticed you have

    Code:
    include /home/nginx/domains/forums.mashtyha.com/public/nginx.conf;
    what's inside /home/nginx/domains/forums.mashtyha.com/public/nginx.conf ? ( wrap in CODE tags)
     
  18. Cr0w

    Cr0w Member

    165
    9
    18
    Mar 17, 2015
    Iran
    Ratings:
    +13
    Local Time:
    6:47 PM
    1.9.x
    5.5
    Code:
    location ~* \.(png|jpg|jpeg|gif|ico)$
            {
                    expires 30d;
                    log_not_found off;
            }
    
            location ~ ^((?!dbseo).)*\.php$
            {
                    rewrite ^/(.*)$ /dbseo.php last;
            }
    
            location ~* \.(php)$
            {
                    fastcgi_index index.php;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    include /usr/local/nginx/conf/fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_nam$
                    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
                    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_nam$
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_nam$
            }
    location ~ (admincp/|dbseocp/|modcp/|cron|mobiquo|forumrunner|api\.php|reviewpo$
    }
    
    location ~ /(.*\.php)$ {
    rewrite ^/(.*)$ /dbseo.php last;
    }
    
    this
     
  19. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    there's your problem you duplicated the php.conf include file which is Centmin Mod's default php settings for each Nginx vhost

    Code:
    include /usr/local/nginx/conf/php.conf;
    remove this part in /home/nginx/domains/forums.mashtyha.com/public/nginx.conf

    Code:
            location ~* \.(php)$
            {
                    fastcgi_index index.php;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    include /usr/local/nginx/conf/fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_nam$
                    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
                    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_nam$
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_nam$
            }
    
     
  20. eva2000

    eva2000 Administrator Staff Member

    53,248
    12,117
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,655
    Local Time:
    12:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    FYI, you never have to set or add php location matches to Nginx vhosts via Centmin Mod as the php.conf include takes care of it

    Code:
    include /usr/local/nginx/conf/php.conf;