Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We use a product called VBseo for our vBulletin powered forums. VBSEO comes with nginx rewrite rules in the package, but we cannot get them to work properly and their support hasn't been all that helpful so far.

The purpose of VBSEO is to change vBulletin's default URLs into search engine friendly, keyword-rich URLs. One script (vbseo.php) handles ALL of the rewritten forum URLs. On stock vBulletin, the URLs look like this:

  • /forumdisplay.php?f=1
  • /showthread.php?t=12345
  • /member.php?u=12345

With VBSEO installed, those URLs look like this:

  • /forum-name
  • /forum-name/thread-name.html
  • /members/username.html

What we are experiencing is that the /forum-name rewrite rule is the only one that is working. /forum-name/thread-name.html and /members/username.html are both resulting in a nginx 404.

Here is the entire (rough while we try to figure nginx and rewrites out, so please forgive the ugliness of it all) conf file for the domain.

server {
  server_name site.com www.site.com;
  root "/home/site/public_html";
  index index.php;

  location / {
    try_files $uri $uri/ /index.php$uri?$args;
  }

          location /vb/ {
            rewrite ^/vb/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /vb/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
            try_files $uri $uri/ /vb/vbseo.php?$args;
    }

    location /vb/vbseo/(includes|resources/html|resources/xml)/ {
            allow      127.0.0.1;
            deny      all;
    }

  location ~ "^(.+\.php)($|/)" {
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SERVER_NAME $host;

    if ($uri !~ "^/uploads/") {
      fastcgi_pass   127.0.0.1:9002;
    }
    include        fastcgi_params;
  }
}

Does anything here stand out to you as a reason that we'd be getting 404s on some of our rewritten URLs but not all of them? I'm about at my wit's end trying to figure this out.

For reference, here is what their .htaccess rules look like:

RewriteEngine On
RewriteBase /vb/
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap|api\.php)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]
share|improve this question
    
You might want to reformat that configuration file so that it's easier to read. Subtle errors can sneak in when you have a file that looks like that. Also, many of us know nginx but not vBulletin, so you should explain exactly what you expect your rewrite rules to do. –  Michael Hampton Mar 5 '13 at 1:14
    
I've attempted to clean up the file and add a little bit more information as to what vbseo does and what isn't working. –  Kevin Mar 5 '13 at 1:55
    
It seems to me that the .htaccess is not factoring in the .html extension into some of those URLs. Very tough to say how to adjust your .htaccess to accommodate, but there would have to be lines in place to accommodate for username.html and such. –  JakeGould Mar 5 '13 at 3:16
    
We aren't using the .htaccess file - We are using nginx rewrites. I only posted the .htaccess file so that someone knowledgeable with both platforms could compare and maybe spot the difference. –  Kevin Mar 5 '13 at 3:19
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.