# Request rewrite emergency\*

**URL:** <https://www.ruby-forum.com/t/request-rewrite-emergency/176653>\
**Category:** NGINX\
**Created:** [October 4, 2009, 3:43am UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653 "2009-10-04T03:43:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 3:43am UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/1 "2009-10-04T03:43:53Z")

</div>

Hello everybody here in NGINX  
Hello Igor, and others.

I need a help regarding rewrite problem

Source:

# 

RewriteEngine on

# Some hostings require RewriteBase to be uncommented

# Example:

# Your store url is [yourcompany.com is available for purchase - Sedo.com](http://www.yourcompany.com/store/cart)

# So “RewriteBase” should be:

# RewriteBase /store/cart

#RewriteBase /  
#RewriteCond %{REQUEST\_FILENAME} !.(png|gif|ico|swf|jpe?g|js|css)$  
#RewriteCond %{REQUEST\_FILENAME} !-f  
#RewriteCond %{REQUEST\_FILENAME} !-d  
#RewriteRule . index.php?sef\_rewrite=1

#RewriteCond %{REQUEST\_FILENAME} ._/catalog/._  
#RewriteCond %{REQUEST\_FILENAME} -d  
#RewriteCond %{REQUEST\_FILENAME}/index.html !-f  
#RewriteRule . index.php?sef\_rewrite=1

# 

i try this one:  
location / {  
if ($request\_filename ~ “.html$”) {  
rewrite ^/(.\*)/t-([0-9]+).html$ /index.php?sef\_rewrite=1  
permanent;  
}  
}

but it doesnt work, -\_\_-  
please guide me, thank you very much.

Posted at Nginx Forum:

> **[request rewrite emergency\*](https://forum.nginx.org/read.php?2,11040,11040#msg-11040)**
>
> Hello everybody here in NGINX Hello Igor, and others. I need a help regarding rewrite problem \[quote\] Source: #\<IfModule mod\_rewrite.c\> RewriteEngine on # Some hostings require RewriteBase to be uncommented # Example:

---

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 4:01am UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/2 "2009-10-04T04:01:26Z")

</div>

RewriteRule /catalog/(._) /catalog/$1  
RewriteRule /lib/(._) /lib/$1  
RewriteRule /skins/(._) /skins/$1  
RewriteRule /payments/(._) /payments/$1  
RewriteRule /images/(._) /images/$1  
RewriteRule /index.php(._) /index.php$1  
RewriteRule /admin.php(._) /admin.php$1  
RewriteRule ^(._)$ /index.php?sef\_rewrite=1

Posted at Nginx Forum:

> **[Re: request rewrite emergency\*](https://forum.nginx.org/read.php?2,11040,11045#msg-11045)**
>
> Hello everybody here in NGINX Hello Igor, and others. I need a help regarding rewrite problem \[quote\] Source: #\<IfModule mod\_rewrite.c\> RewriteEngine on # Some hostings require RewriteBase to be uncommented # Example:

---

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 8:20am UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/3 "2009-10-04T08:20:42Z")

</div>

> RewriteRule /catalog/(._) /catalog/$1  
> RewriteRule /lib/(._) /lib/$1  
> RewriteRule /skins/(._) /skins/$1  
> RewriteRule /payments/(._) /payments/$1  
> RewriteRule /images/(._) /images/$1  
> RewriteRule /index.php(._) /index.php$1  
> RewriteRule /admin.php(.\*) /admin.php$1

> RewriteRule ^(.\*)$ /index.php?sef\_rewrite=1

Do you realize that everything except this one rule is a NO-OP?

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

---

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/4 "2009-10-04T21:39:36Z")

</div>

On Sat, Oct 03, 2009 at 09:36:20PM -0400, saiyan wrote:

> # Example:
> 
> #RewriteCond %{REQUEST\_FILENAME} -d  
> }
> 
> but it doesnt work, -\_\_-  
> please guide me, thank you very much.

location ~ .(png|gif|ico|swf|jpe?g|js|css)$ {  
try\_files $uri $uri/ /index.php?sef\_rewrite=1  
}

location ~ /catalog/ {  
try\_files $uri/index.html /index.php?sef\_rewrite=1  
}

---

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/5 "2009-10-04T21:39:01Z")

</div>

On Sun, Oct 04, 2009 at 02:13:05AM -0400, anomalizer wrote:

> Do you realize that everything except this one rule is a NO-OP?  
> They are very heavy noops.

---

<div class="post-metadata">

**Author:** ![saiyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@saiyan](https://www.ruby-forum.com/u/saiyan)\
**Post date:** [October 4, 2009, 9:41pm UTC](https://www.ruby-forum.com/t/request-rewrite-emergency/176653/6 "2009-10-04T21:41:22Z")

</div>

On Sat, Oct 03, 2009 at 09:57:52PM -0400, saiyan wrote:

> RewriteRule /catalog/(._) /catalog/$1  
> RewriteRule /lib/(._) /lib/$1  
> RewriteRule /skins/(._) /skins/$1  
> RewriteRule /payments/(._) /payments/$1  
> RewriteRule /images/(._) /images/$1  
> RewriteRule /index.php(._) /index.php$1  
> RewriteRule /admin.php(._) /admin.php$1  
> RewriteRule ^(._)$ /index.php?sef\_rewrite=1

```
 location / {
     rewrite ^ /index.php?sef_rewrite=1;
 }

 location /catalog/ {
     fastcgi_pass ...
 }

 location /lib/ {
     fastcgi_pass ...
 }

 location /skins/ {
     fastcgi_pass ...
 }

 location /payments/ {
     fastcgi_pass ...
 }

 location /images/ {
     fastcgi_pass ...
 }

 location /index.php {
     fastcgi_pass ...
 }

 location /admin.php {
     fastcgi_pass ...
 }

```
