Want to subscribe to topics you're interested in?
Become a Member

Nginx How to redirect www.domain.com to www.domain.com/forums ?

Discussion in 'Nginx and PHP-FPM news & discussions' started by modder, May 5, 2020.

  1. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:13 PM
    I'm using CENTOS 7 and latest CENTMINMOD now.

     
  2. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:13 PM
    There are so much to read!

    Code (Text):
    server {
          listen   80;
          server_name myplace.com www.myplace.com;
          return 301 https://$server_name$request_uri;
    }
    
    server {
      listen 443 ssl http2 reuseport;
      server_name myplace.com www.myplace.com;
      rewrite ^/$ /forums redirect;


    I added the last line...

    rewrite ^/$ /forums redirect;

    And it works. Is the the best way to do it?

    Thanks.
     
  3. JoeDer

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    10:13 AM
    Nginx 1.21.x
    MariaDB 10.3.x