microz
Verified User
Hi,
I'm trying change from apache to nginx, but I need convert htaccess to nginx to work permlinks.
I'm use https://winginx.com/en/htaccess for convert and get.
Then when I add in Custom HTTPD configuration, the directadmin return:
Any suggestion? What should be the correctly args for replace in $0?
Thanks!
I'm trying change from apache to nginx, but I need convert htaccess to nginx to work permlinks.
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
# --- Redirect from http to https
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ---
# --- Redirect from non-www to www
#RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
#RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]
# ---
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ %2index.php?page=$0&%{QUERY_STRING} [QSA,L]
</IfModule>
I'm use https://winginx.com/en/htaccess for convert and get.
Code:
location / { if (!-e $request_filename){ rewrite ^(.*)$ /%2index.php?page=$0&$query_string break; } }
Then when I add in Custom HTTPD configuration, the directadmin return:
Code:
nginx: [emerg] unknown "0" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
Any suggestion? What should be the correctly args for replace in $0?
Thanks!
Last edited: