# Help writing apache htaccess for nginx

**URL:** <https://www.ruby-forum.com/t/help-writing-apache-htaccess-for-nginx/215200>\
**Category:** NGINX\
**Created:** [December 26, 2011, 4:10pm UTC](https://www.ruby-forum.com/t/help-writing-apache-htaccess-for-nginx/215200 "2011-12-26T16:10:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 26, 2011, 4:10pm UTC](https://www.ruby-forum.com/t/help-writing-apache-htaccess-for-nginx/215200/1 "2011-12-26T16:10:45Z")

</div>

I have this htaccess file that’s used in my zend project. We just moved  
from apache to nginx

# Rewrite rules for Zend Framework

RewriteEngine on  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteCond %{REQUEST\_URI} !/public.\*  
RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php

# Security: Don’t allow browsing of directories

Options -Indexes

#RewriteBase ‘/’  
Part of my nginx server file has this

```
        location /public {
        }
        location ~ \.(js|ico|gif|jpg|png|css)$ {
        }
        location /not_found {
        }
        location /404.html {
                internal;
        }

```

When we were on apache the /public folder would be  
[domain.com/public/js/ColVis.min.js](http://domain.com/public/js/ColVis.min.js)

Now nginx is making the URL’s like this, it appends /public to whatever  
URL you are on the site  
[domain.com/billingpreferences/public/js/ColVis.min.js](http://domain.com/billingpreferences/public/js/ColVis.min.js)

This is breaking the entire site, what can I change in the nginx config  
file

Posted at Nginx Forum:

> **[Help writing apache htaccess for nginx](https://forum.nginx.org/read.php?2,220493,220493#msg-220493)**
>
> I have this htaccess file that's used in my zend project. We just moved from apache to nginx # Rewrite rules for Zend Framework RewriteEngine on RewriteCond %{REQUEST\_FILENAME} !-f RewriteCond %{REQUEST\_URI} !/public.\* RewriteRule...
