(2009-06-22, 02:03 PM)frostschutz Wrote: If you are using Nginx instead of Apache web server, this tutorial explains how you can enable MyBB's Search Engine Friendly SEF URLs. Apache users do not need to read this tutorial.
This tutorial does not explain how to install and set up Nginx with PHP from scratch; it is expected that you already have everything up and running, and now all that's left are the SEF URLs.
nginx.conf
First you should make a backup copy of your nginx.conf, so you can go back to your working config in case anything goes wrong.
In the server / location section, add these rewrite rules. Replace /MyBB/ with the directory you have MyBB installed. If your MyBB is installed in a top level domain, replace it with /, if it's in /forum replace it with /forum/ and so on.
Please note that every rewrite statement goes in a single line even if it wraps in your browser here.
In Admin CP, go to 'Configuration' -> 'Server and Optimization options' and set 'Enable search engine friendly URLs?' to 'Enabled'. (The auto detect option will not work with Nginx.)
Go back into your forum and test if the MyBB SEF URLs work.
Troubleshooting
Nginx refuses to start
You probably made an error when editing the config file; Nginx should tell you where the error is, correct it.
I get 404 errors when clicking on thread / forum links
Your rewrite rules are not working. Maybe you used the wrong path (in the example /MyBB/). Replace it with the correct path, for example / or /forum/. Also check if you installed Nginx with PCRE and HttpRewriteModule support.
Hi frost,
Please help, I get the error as you said:
Restart Nginx so the changes can take effect. =>> DONE
I get 404 errors when clicking on thread / forum linksYour rewrite rules are not working. Maybe you used the wrong path (in the example /MyBB/). Replace it with the correct path, for example / or /forum/. => It's OK! I've checked it.
Also check if you installed Nginx with PCRE and HttpRewriteModule support. => It's OK too.
In Admin CP, go to 'Configuration' -> 'Server and Optimization options' and set 'Enable search engine friendly URLs?' to 'Enabled' => DONE
I am using VPS:
512MB Ram
20GB SSD Disk
CentOS 6.5 x64
I installed Centminmod.
When I using this:
# GOOGLE SEO PLUGIN 1.6.8
# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
rewrite ^/([^&]*)&(.*)$ http://windowstech.net/$1?$2 permanent;
# Google SEO Sitemap:
rewrite ^/((?i)sitemap-([^./]+)\.xml)$ /misc.php?google_seo_sitemap=$2;
# Google SEO URL Forums:
rewrite ^/((?i)Forum-([^./]+))$ /forumdisplay.php?google_seo_forum=$2;
# Google SEO URL Threads:
rewrite ^/((?i)Thread-([^./]+))$ /showthread.php?google_seo_thread=$2;
# Google SEO URL Announcements:
rewrite ^/((?i)Announcement-([^./]+))$ /announcements.php?google_seo_announcement=$2;
# Google SEO URL Users:
rewrite ^/((?i)User-([^./]+))$ /member.php?action=profile&google_seo_user=$2;
# Google SEO URL Calendars:
rewrite ^/((?i)Calendar-([^./]+))$ /calendar.php?google_seo_calendar=$2;
# Google SEO URL Events:
rewrite ^/((?i)Event-([^./]+))$ /calendar.php?action=event&google_seo_event=$2;
and click Apply in the Google SEO plugin, my site can rewrite URL as: domain.com/Thread-... or domain.com/Forum-... =>> OK
but when I using your rules:
my site cannot rewrite, I get 404 Not Found - nginx Error.
Now I want rewrite URL like: domain.com/forum-123.html or domain.com/thread-123.html and the URL like: domain.com/Forum-... or domain.com/Thread-... can be redirected to the URL like: domain.com/forum-123.html or domain.com/thread-123.html
Please help me to resolve this problem! Many thanks in advance!
2014-12-07, 08:21 PM (This post was last modified: 2014-12-07, 08:22 PM by bekircem.)
(2009-06-22, 02:03 PM)frostschutz Wrote: If you are using Nginx instead of Apache web server, this tutorial explains how you can enable MyBB's Search Engine Friendly SEF URLs. Apache users do not need to read this tutorial.
This tutorial does not explain how to install and set up Nginx with PHP from scratch; it is expected that you already have everything up and running, and now all that's left are the SEF URLs.
nginx.conf
First you should make a backup copy of your nginx.conf, so you can go back to your working config in case anything goes wrong.
In the server / location section, add these rewrite rules. Replace /MyBB/ with the directory you have MyBB installed. If your MyBB is installed in a top level domain, replace it with /, if it's in /forum replace it with /forum/ and so on.
Please note that every rewrite statement goes in a single line even if it wraps in your browser here.
In Admin CP, go to 'Configuration' -> 'Server and Optimization options' and set 'Enable search engine friendly URLs?' to 'Enabled'. (The auto detect option will not work with Nginx.)
Go back into your forum and test if the MyBB SEF URLs work.
Troubleshooting
Nginx refuses to start
You probably made an error when editing the config file; Nginx should tell you where the error is, correct it.
I get 404 errors when clicking on thread / forum links
Your rewrite rules are not working. Maybe you used the wrong path (in the example /MyBB/). Replace it with the correct path, for example / or /forum/. Also check if you installed Nginx with PCRE and HttpRewriteModule support.
In my nginx.conf, there is no location. Here is my nginx.conf:
What is in your "/usr/local/apps/nginx/etc/conf.d/" directory? There should be at least one configuration file setting up a vhost to serve, even if its just the default vhost.
2014-12-07, 11:22 PM (This post was last modified: 2014-12-07, 11:31 PM by bekircem.)
(2014-12-07, 10:42 PM)Euan T Wrote: Hi,
What is in your "/usr/local/apps/nginx/etc/conf.d/" directory? There should be at least one configuration file setting up a vhost to serve, even if its just the default vhost.
2015-07-19, 05:08 PM (This post was last modified: 2015-07-19, 05:20 PM by josharcher.)
Just in case anyone gets this far, you've activated the "Enable search engine friendly URLs in Archive?" option and find that pagination on the archives aren't working, you can ADD the following lines:
2015-07-19, 09:11 PM (This post was last modified: 2015-07-19, 09:12 PM by frostschutz.)
This user has been denied support.
FYI, those archive URLs aren't rewrites, they're PATH_INFO, which can be set up to work with nginx, but it's tricky. You find many nginx+PATH_INFO guides with Google but most of them have issues. So if you don't need general PATH_INFO support and those rewrites work for you...
2017-08-12, 10:41 PM (This post was last modified: 2017-08-12, 10:43 PM by frostschutz.)
This user has been denied support.
"URL is passive. Apply changes to core files to activate" "Click to Apply changes to core files." You have to click the Apply link in there.
If the URLs don't show up in the first place, it's a problem with Google SEO setup. If the URL show up but don't actually work, it's a problem with your rewrites.
Note this thread isn't about Google SEO at all. It's about MyBB's forum-123.html URLs. There is an nginx example included in the Google SEO package.