Welcome! Log In Create A New Profile


htaccess to nginx conversion?

May 21, 2015 09:45PM

I am working with a panel in which requires the pages to function properly from the .htaccess file. However, I am no longer using Apache and have decided to do a Centmin Mod LEMP web stack to improve performance and whatnot. Anyways, I used this online converter http://winginx.com/en/htaccess and when I put the code it gave me into my vhost.conf file, I got an error (see below). The error occurs even when I place that code in my domain.com.conf file, vhost.conf file, or nginx.conf file. The URL types my panel uses are http://domain.com/staff/core.staffDetails and it's throwing a 404 error simply because it's not reading the .htaccess file since I'm using Nginx.

The error I'm receiving:

[root@radio ~]# ngxrestart
nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/conf.d/virtual.conf:50

Again, that happens even when I try the other files listed above.

.htaccess code I need converted:

Options -Indexes

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico

RewriteRule ^(.*)(\.)(.*)$ index.php?url=$1.$3 [L,QSA]
RewriteRule ^ajax$ _res/ajax.php [QSA]
#RewriteRule ^(.*)$ index.php?t=$1 [L,QSA]

I am using a Linux VPS running CentOS 6.5 if that information is needed.

Thank you!
Subject Author Posted

htaccess to nginx conversion?

tdubs May 21, 2015 09:45PM

Re: htaccess to nginx conversion?

Quân Thứ September 06, 2015 01:18PM

Re: htaccess to nginx conversion?

B.R. September 07, 2015 03:36AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready