Migrating PhpBB-Seo (seo premod forum) from apache to nginx requires, of course, database migration, php files with attachments and last, but not least, rewrite rules migration.
Here is an example of a few Apache RewriteRule for phpbb-seo:
- Code: Select all
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^announces/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$2&start=$4 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&s tart=$5 [QSA,L,NC]
and below the equivalent rewrite rules for phpbb-seo in nginx:
- Code: Select all
rewrite ^/(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 last;
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER ALL MODES
rewrite ^/announces/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$2&start=$4 last;
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
rewrite ^/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 last;
The trick is to follow these rules:
- RewriteRule becomes rewrite
- in nginx the rewrite rules require a forward slash (/) after the ^ character (in regex it means that the URL should start with a forward slash), while Apache doesn't require this.
Ex.
- Code: Select all
^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$
- Code: Select all
^/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$
-Following
- Code: Select all
[QSA,L,NC]
- Code: Select all
last;
- nginx rewrite rules are NOT read from .htaccess files (this should be obvious), but from nginx.conf or from nginx vhost configuration file, depending on your configuration.


News