# Rewrite rule for nginx from Apache

**URL:** <https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154>\
**Category:** NGINX\
**Created:** [November 18, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154 "2009-11-18T16:17:23Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![sovok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sovok](https://www.ruby-forum.com/u/sovok)\
**Post date:** [May 26, 2011, 6:14am UTC](https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154/21 "2011-05-26T06:14:35Z")

</div>

I still do not understand the previous explanation

Can you help me to convert my htaccess to nginx…

RewriteEngine on  
RewriteRule ^$ index.php [L]  
RewriteCond $1  
!^(index.php|info.php|dotpro|poploud|users|upload\_pic|static|oauth|sharefb|dotproject|error|facebook|blog|system/application/views/(apps-images|css-libraries|js-libraries|swf-library|video-library)|AuthSub.php|robots.txt|favicon.ico|insecure.php)  
RewriteRule ^(.\*)$ index.php/$1 [L]

thank’s

Posted at Nginx Forum:

> **[Re: Rewrite rule for nginx from Apache](https://forum.nginx.org/read.php?2,23868,201013#msg-201013)**
>
> Can anyone tell me how to rewrite this rules from apache: RewriteEngine On RewriteRule ^shorten/(.\*)$ shorten.php?longurl=$1 \[L\] RewriteRule ^(\[0-9a-zA-Z\]{1,6})$ redirect.php?url=$1 \[L\] to nginx? Thanks! -- Posted via http://www.ruby-fo

---

<div class="post-metadata">

**Author:** ![sovok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sovok](https://www.ruby-forum.com/u/sovok)\
**Post date:** [May 26, 2011, 3:52pm UTC](https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154/22 "2011-05-26T15:52:13Z")

</div>

On Thu, May 26, 2011 at 09:46:47AM -0400, the\_traveller wrote:

> the public\_html dir is in  
> /usr/local/www

location /Joke/ {  
fastcgi\_pass backend;  
fastcgi\_param SCRIPT\_FILENAME /usr/local/www/public\_html/jokes.php;  
fastcgi\_param QUERY\_STRING $args;  
inlcude fastcgi\_params;  
}

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![sovok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@sovok](https://www.ruby-forum.com/u/sovok)\
**Post date:** [May 26, 2011, 3:47pm UTC](https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154/23 "2011-05-26T15:47:17Z")

</div>

the public\_html dir is in  
/usr/local/www

Posted at Nginx Forum:

> **[Re: Rewrite rule for nginx from Apache](https://forum.nginx.org/read.php?2,23868,201159#msg-201159)**
>
> Can anyone tell me how to rewrite this rules from apache: RewriteEngine On RewriteRule ^shorten/(.\*)$ shorten.php?longurl=$1 \[L\] RewriteRule ^(\[0-9a-zA-Z\]{1,6})$ redirect.php?url=$1 \[L\] to nginx? Thanks! -- Posted via http://www.ruby-fo

[Previous page](https://www.ruby-forum.com/t/rewrite-rule-for-nginx-from-apache/179154.md?page=1)
