• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Hướng dẫn rewrite url cho phpbb seo trên nginx

Admin

Well-Known Member
Staff member
Administrator
PHPBB SEO là mã nguồn forum seo miễn phí nhưng khá tốt. Đặt biệt là nó rất nhẹ. Nhưng nếu bạn dùng nginx thì rất có thể bạn gặp vấn đề với cấu hình Rewrite

Trong PHPBB SEO có rất nhiều lựu chọn tùy biến URL
  • Advanced mode
  • Mixed mode
  • Simple mode
Nhưng những Rewrite chỉ có sẵn cho .htaccess của apache.
Để hoạt động với nginx thì bạn cần phải chuyển đổi rules để cho phù hợp với nginx
PHP:
location / {
rewrite ^/f([0-9]+)/?$ /viewforum.php?f=$1 last;
rewrite ^/f([0-9]+)/page([0-9]+)\.html?$ /viewforum.php?f=$1&start=$2 last;
rewrite ^/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html /viewtopic.php?forum_uri=$1&t=$3&start=$5 last;
rewrite ^/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 last;
rewrite ^/(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$2&start=$4 last;
}

location /resources {
  rewrite ^/resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /download/file.php?id=$2&t=$1 last;
}

location /member {
  rewrite ^/member/([^/]+)/?$ /memberlist.php?mode=viewprofile&un=$1 last;
  rewrite ^/member/([^/]+)/(topics|posts)/?(page([0-9]+)\.html)?$ /search.php?author=$1&sr=$2&start=$4 last;
}

location /post {
  rewrite ^/post([0-9]+)\.html /viewtopic.php?p=$1 last;
}

location /active {
  rewrite ^/active-topics(-([0-9]+))?\.html$ /search.php?search_id=active_topics&start=$2&sr=topics last;
}

location /unanswered {
  rewrite ^/unanswered(-([0-9]+))?\.html$ /search.php?search_id=unanswered&start=$2&sr=topics last;
}

location /newposts {
  rewrite ^/newposts(-([0-9]+))?\.html$ /search.php?search_id=newposts&start=$2&sr=topics last;
}

location /unreadposts {
  rewrite ^/unreadposts(-([0-9]+))?\.html$ /search.php?search_id=unreadposts&start=$2 last;
}

location /the {
  rewrite ^/the-team\.html$ /404.php last;
}

location /rss {
  rewrite ^/rss(/(news)+)?(/(digest)+)?(/(short|long)+)?/?$ /gymrss.php?channels&$2&$4&$6 last;
  rewrite ^/rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$9=$8&$2&$4&$6&gzip=$10 last;
}

location /news {
  rewrite ^/(news|maps)/?(page([0-9]+)\.html)?$ /map.php?$1&start=$3 last;
  rewrite ^/(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ /map.php?$2=$4&$1&start=$6 last;
}

location /maps {
  rewrite ^/(news|maps)/?(page([0-9]+)\.html)?$ /map.php?$1&start=$3 last;
  rewrite ^/(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ /map.php?$2=$4&$1&start=$6 last;
}

location /sitemapindex {
  rewrite ^/sitemapindex\.xml(\.gz)?$ /sitemap.php?gzip=$1 last;
}
Chúc các bạn thành công!
Theo DVPDA
 

Facebook Comments

New posts New threads New resources

Back
Top