htaccess to nginx conversion?

tdubs nginx-forum at nginx.us
Fri May 22 01:45:32 UTC 2015


Hello,

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 at 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]
</IfModule>
---

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

Thank you!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259054,259054#msg-259054



More information about the nginx mailing list