Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
907 views
in Q2A Core by

I have moved my q2a site from Apache server to the NGINX server for better performance and speed.

But the first url structure require .htaccess to work but it is not working on NGINX and the first url not working.

I have tried some tips provided in this site Q&A but still it is not working.

I need this url sturcture

/123/why-do-birds-sing (requires htaccess file)

Code written in .htaccess file:

Options -Indexes

DirectoryIndex index.php

<IfModule mod_rewrite.c>

RewriteEngine On

#RewriteBase /

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$

RewriteRule . %1/%2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

</IfModule>

How to convert this code to work in NGINX server?

Please help 

Q2A version: 1.8.0

1 Answer

0 votes
by

On your webserver terminal enter this:

sudo vim /etc/nginx/sites-available/default 

Then add the lines in the following link to the right position

https://www.question2answer.org/qa/43081/the-correct-rule-of-rewrite-for-nginx

...