Mình mới chuyển diễn đàn vbb sang chạy trên nginx, sau một hồi tham khảo internet cuối cùng cũng tìm được cái Nginx rewrite rules cho vBSEO. Post nên cho anh em nào dùng VBB tham khảo
File .htaccess rewrite mặc định của vBSEO
- Mã: Chọn tất cả
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
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]
Convert sang Nginx rewrite rules:
- Mở file rules mặc định của nginx, tìm location / {
- Thêm vào đằng sau:
- Mã: Chọn tất cả
rewrite ^/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
if ($request_filename ~ “\.php$” ) {
rewrite ^(.*)$ /vbseo.php last;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /vbseo.php last;
}
- Lưu lại và restart nginx: service nginx restart
- Demo: http://sv9x.net
- Tham khảo thêm: http://lumanau.web.id/2009/01/16/nginx-rewrite-rules-for-vbulletin-vbseo.html