# Need help to convert .htaccess to nginx rules

**URL:** <https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144>\
**Category:** NGINX\
**Created:** [March 5, 2013, 6:40pm UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144 "2013-03-05T18:40:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 5, 2013, 6:40pm UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/1 "2013-03-05T18:40:07Z")

</div>

[code]\<Files \*.htm\>  
#Compress  
SetOutputFilter DEFLATE  
  
Options +FollowSymLinks  
RewriteEngine on  
RewriteBase /

# please use .php at url for admin

RewriteRule ^recent-articles-feed rss.php [NC]  
RewriteRule ^rss/([^/]+) rss.php?q=$1 [NC]

# To ignore htaccess - enlist here

RewriteCond $1  
!^(index.php|ftpservice|demo|ftpdb|MDF|phpsysinfo|admin|templates|links|api|forum|articles|imageGallery|language|includes|ajax|resources|fonts|images|parse|directory|uploads|system|rss.php|robots.txt|sitemap.php|Sitemap.xml|sitemap.xml|sitemap2.xml|urllist.txt)

RewriteRule ^(.\*) index.php [NC] [/code]

This is my htaccess content .

Posted at Nginx Forum:

> **[Need help to convert .htaccess to nginx rules](https://forum.nginx.org/read.php?2,236960,236960#msg-236960)**
>
> \[code\]\<Files \*.htm\> #Compress SetOutputFilter DEFLATE \</Files\> Options +FollowSymLinks RewriteEngine on RewriteBase / # please use .php at url for admin RewriteRule ^recent-articles-feed rss.php \[NC\] RewriteRule ^rss/(\[^/\]+)

---

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 6, 2013, 7:31am UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/2 "2013-03-06T07:31:22Z")

</div>

maybe this helps as a start:

> <https://stackoverflow.com/questions/5840497/convert-htaccess-to-nginx>

and you may want to read  
[http://wiki.nginx.org/HttpCoreModule#location](http://wiki.nginx.org/HttpCoreModule#location)  
[http://wiki.nginx.org/HttpRewriteModule](http://wiki.nginx.org/HttpRewriteModule)

since usage and order-of-procerssing is quite a little different

regards,

mex

Posted at Nginx Forum:

> **[Re: Need help to convert .htaccess to nginx rules](https://forum.nginx.org/read.php?2,236960,236975#msg-236975)**
>
> \[code\]\<Files \*.htm\> #Compress SetOutputFilter DEFLATE \</Files\> Options +FollowSymLinks RewriteEngine on RewriteBase / # please use .php at url for admin RewriteRule ^recent-articles-feed rss.php \[NC\] RewriteRule ^rss/(\[^/\]+)

---

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 6, 2013, 1:35pm UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/3 "2013-03-06T13:35:29Z")

</div>

2013/3/6 onel0ve [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I just need to convert this to nginx rules .

I guess, the thing is, that you shall learn, how this can be achieved.  
So you can do it on your own the next time.  
In case you’ve tried it yet, it may be helpful to show your attempts.  
Look, it seems that you want others to do your job. As far as I can  
tell many people will refuse to do so.

So show some love and see what comes back 😉

Regards,

André

---

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 6, 2013, 4:39pm UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/4 "2013-03-06T16:39:37Z")

</div>

On 6 March 2013 12:34, Andre J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 2013/3/6 onel0ve [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > I just need to convert this to nginx rules .
> 
> I guess, the thing is, that you shall learn, how this can be achieved.  
> So you can do it on your own the next time.  
> In case you’ve tried it yet, it may be helpful to show your attempts.  
> Look, it seems that you want others to do your job. As far as I can  
> tell many people will refuse to do so.
> 
> So show some love and see what comes back 😉

+1. Show your working, show where you got stuck or what doesn’t work,  
and you’ll find people are much more eager to help you 🙂

## Jonathan

Jonathan M. // Oxford, London, UK

> **[Jonathan Matthews :: Words Typed, Great Rates For Cash](https://www.jpluscplusm.com)**

---

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 7, 2013, 5:34pm UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/5 "2013-03-07T17:34:03Z")

</div>

ok  
CAn you just tell how to exclude a directory from nginx rules ? . I want  
to  
disable mod rewrite for one sub folder .

Posted at Nginx Forum:

> **[Re: Need help to convert .htaccess to nginx rules](https://forum.nginx.org/read.php?2,236960,237083#msg-237083)**
>
> \[code\]\<Files \*.htm\> #Compress SetOutputFilter DEFLATE \</Files\> Options +FollowSymLinks RewriteEngine on RewriteBase / # please use .php at url for admin RewriteRule ^recent-articles-feed rss.php \[NC\] RewriteRule ^rss/(\[^/\]+)

---

<div class="post-metadata">

**Author:** ![onel0ve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@onel0ve](https://www.ruby-forum.com/u/onel0ve)\
**Post date:** [March 6, 2013, 11:13am UTC](https://www.ruby-forum.com/t/need-help-to-convert-htaccess-to-nginx-rules/227144/6 "2013-03-06T11:13:27Z")

</div>

I just need to convert this to nginx rules .

# To ignore htaccess - enlist here

RewriteCond $1  
!^(index.php|ftpservice|demo|ftpdb|MDF|phpsysinfo|admin|templates|links|  
api|forum|articles|imageGallery|language|includes|ajax|resources|fonts|images|parse|directory|  
uploads|system|rss.php|robots.txt|sitemap.php|Sitemap.xml|sitemap.xml|sitemap2.xml|urllist.txt)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,236960,236980#msg-236980](http://forum.nginx.org/read.php?2,236960,236980#msg-236980)
