# Rewrite in Ngnix

**URL:** <https://www.ruby-forum.com/t/rewrite-in-ngnix/219130>\
**Category:** NGINX\
**Created:** [April 21, 2012, 8:11am UTC](https://www.ruby-forum.com/t/rewrite-in-ngnix/219130 "2012-04-21T08:11:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [April 21, 2012, 8:11am UTC](https://www.ruby-forum.com/t/rewrite-in-ngnix/219130/1 "2012-04-21T08:11:51Z")

</div>

Hi,  
How convert to httacces from apache to nginx

My file htaccess is:

#Options FollowSymLinks

RewriteEngine on

RewriteRule ^vardata/(.\*).php$ [R=404,L]  
RewriteRule ^([a-zA-Z0-9\_-]+).html$ index.php?op=$1  
RewriteRule ^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2  
RewriteRule ^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3  
RewriteRule  
^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3&qs=$4  
RewriteRule  
^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3&qs=$4&ne=$5  
RewriteRule  
^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3&qs=$4&ne=$5&nr=$6  
RewriteRule  
^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3&qs=$4&ne=$5&nr=$6&ha=$7  
RewriteRule  
^([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+),([a-zA-Z0-9\_-]+).html$  
index.php?op=$1&do=$2&id=$3&qs=$4&ne=$5&nr=$6&ha=$7&hs=$8 [L]

HELP Me!

Posted at Nginx Forum:

> **[Rewrite in Ngnix](https://forum.nginx.org/read.php?2,225583,225583#msg-225583)**
>
> Hi, How convert to httacces from apache to nginx My file htaccess is: #Options FollowSymLinks RewriteEngine on RewriteRule ^vardata/(.\*).php$ \[R=404,L\] RewriteRule ^(\[a-zA-Z0-9\_-\]+).html$ index.php?op=$1 RewriteRule ^(\[

---

<div class="post-metadata">

**Post date:** [April 21, 2012, 3:01pm UTC](https://www.ruby-forum.com/t/rewrite-in-ngnix/219130/2 "2012-04-21T15:01:45Z")

</div>

On 21 April 2012 07:11, xxx [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,  
> How convert to httacces from apache to nginx  
> HELP Me!

Step 1: Read and understand the documentation at

> **[Module ngx\_http\_rewrite\_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite)**
>
> The ngx\_http\_rewrite\_module module is used to change request URI using PCRE regular expressions, return redirects, and conditionally select configurations.

Step 2: Understand what your existing rewrite rules are doing  
Step 3: Rewrite your rewrite rules

Let us know how you get on and also – if you get stuck – what you’ve  
tried, what’s worked, and what hasn’t worked.

## Cheers, Jonathan

Jonathan M.  
Oxford, London, UK

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

---

<div class="post-metadata">

**Post date:** [April 22, 2012, 10:51am UTC](https://www.ruby-forum.com/t/rewrite-in-ngnix/219130/3 "2012-04-22T10:51:48Z")

</div>

Please help me, i can not run my nginx because i haven’t good rewrite  
rules

Posted at Nginx Forum:

> **[Re: Rewrite in Ngnix](https://forum.nginx.org/read.php?2,225583,225616#msg-225616)**
>
> Hi, How convert to httacces from apache to nginx My file htaccess is: #Options FollowSymLinks RewriteEngine on RewriteRule ^vardata/(.\*).php$ \[R=404,L\] RewriteRule ^(\[a-zA-Z0-9\_-\]+).html$ index.php?op=$1 RewriteRule ^(\[

---

<div class="post-metadata">

**Post date:** [April 22, 2012, 11:42am UTC](https://www.ruby-forum.com/t/rewrite-in-ngnix/219130/4 "2012-04-22T11:42:36Z")

</div>

No. You must try translating your Apache rewrite rules to start with.  
Show us what you try, and where you get stuck - then someone may be  
willing to help you understand what you’ve got wrong.

No-one here should just do the whole thing for you if you’re too lazy  
even to try for yourself.

## Jonathan

Jonathan M.  
Oxford, London, UK

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