The correct rule of rewrite for nginx Question2Answer

The correct rule of rewrite for nginx Question2Answer

location / {
    index index.php index.html index.htm;
    if (!-e $request_filename) {
       rewrite ^/(.+)?$ /index.php?qa-rewrite=$1 last;
    }
}

and for q2a in subfolder

  location /qa {
                index index.php index.html index.htm;
                 if (!-e $fastcgi_script_name) {
                rewrite ^/qa/(.+)?$ /qa/index.php?qa-rewrite=$1 last;
         }

}

With these configurations, your Nginx server should be properly set up to handle Q2A whether it’s installed in the root directory or within a subfolder. These steps ensure URL rewriting is configured correctly, which is essential for the Q2A application to function as expected.

Related Articles

Responses

Your email address will not be published. Required fields are marked *