# Htaccess to nginx conversion?

**URL:** <https://www.ruby-forum.com/t/htaccess-to-nginx-conversion/242045>\
**Category:** NGINX\
**Created:** [May 22, 2015, 3:45am UTC](https://www.ruby-forum.com/t/htaccess-to-nginx-conversion/242045 "2015-05-22T03:45:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 22, 2015, 3:45am UTC](https://www.ruby-forum.com/t/htaccess-to-nginx-conversion/242045/1 "2015-05-22T03:45:51Z")

</div>

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  
[htaccess to nginx 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](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.
 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!

Posted at Nginx Forum:

> **[htaccess to nginx conversion?](https://forum.nginx.org/read.php?2,259054,259054#msg-259054)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![tdubs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@tdubs](https://www.ruby-forum.com/u/tdubs)\
**Post date:** [September 6, 2015, 7:16pm UTC](https://www.ruby-forum.com/t/htaccess-to-nginx-conversion/242045/2 "2015-09-06T19:16:10Z")

</div>

You can try L2MP Stack ([http://l2mp.ml](http://l2mp.ml)) It support htaccess and  
Litespeed 6x Faster than Apache

---

<div class="post-metadata">

**Author:** ![tdubs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9e8a1a/32.png) [@tdubs](https://www.ruby-forum.com/u/tdubs)\
**Post date:** [September 7, 2015, 9:36am UTC](https://www.ruby-forum.com/t/htaccess-to-nginx-conversion/242045/3 "2015-09-07T09:36:37Z")

</div>

## Is not coming on a product ML dropping a 1-liner with doubtful assumptions about another one trolling?

_B. R._
