URL rewriting for question2answer site


#1

I have installed question2answer script on my site which uses .htaccess for URL rewriting. Here is my .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>

So what I have to do to work this in easyengine nginx


#2

This is a two-step process:

  1. Convert the Apache .htaccess file to a nginx compatible code. You can use tools like https://winginx.com/en/htaccess to help.

  2. Update the following file with your new code

/opt/easyengine/sites/<your-domain-name>/config/nginx/custom/user.conf

You will need to be careful as some of your code is already present in the main.conf file for nginx located at:

/opt/easyengine/sites/<your-domain-name>/config/nginx/conf.d/main.conf