AlterBrains • Nginx - htaccess
Page 1 of 1

Nginx - htaccess

Posted: October 2nd, 2018, 3:44 pm
by dynikz
Hello,

Does the bridge work in Nginx? With htaccess not being in Nginx, the rewrite rules can not be applied. Can these be converted somehow, or must I use Apache?

Thanks :)

Re: Nginx - htaccess

Posted: October 3rd, 2018, 2:25 am
by Admin
Here is sample config part:

Code: Select all

location / {
  if ($request_filename ~ /phpBB3(.?)$){
    rewrite ^(.*)$ /forum redirect;
  }
  if ($request_filename ~ /phpBB3/index.php){
    rewrite ^(.*)$ /forum?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/ucp.php){
    rewrite ^(.*)$ /forum/user?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/viewforum.php){
    rewrite ^(.*)$ /forum/forum?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/viewtopic.php){
    rewrite ^(.*)$ /forum/topic?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/memberlist.php){
    rewrite ^(.*)$ /forum/members?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/report.php){
    rewrite ^(.*)$ /forum/report?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/posting.php){
    rewrite ^(.*)$ /forum/post?$query_string redirect;
  }
  if ($request_filename ~ /phpBB3/mcp.php){
    rewrite ^(.*)$ /forum/moderator?$query_string redirect;
  }
}
There is nice tool to convert htaccess rules into Nginx config:
https://winginx.com/en/htaccess