Welcome! Log In Create A New Profile

Advanced

Modifying a rewrite rule in nginx for subdomain

Posted by wickedsunny 
Modifying a rewrite rule in nginx for subdomain
January 18, 2011 03:57PM
Hello, I did a little rewrite rule a little while ago to redirect ppl who directly access my site's image to image pages instead,

for example a person accessing www.mysite.com/i/asdf.jpg to www.mysite.com/pic/asdf

this is the rewrite rule i used :

[code]
location /i/image_(\d+).(gif|jpg|jpeg|png)$ {
root /home/mysite/public_html;
valid_referers www.mysite.com mysite.com;
if ($invalid_referer) {
rewrite ^ http://www.mysite.com/pic/$1 permanent;
}
}
[/code]


I made a subdomain of the directory 'i' which contains all the images. so its like thsi now http://i.mysite.com/

Is it possible to make a rewrite like the one above so if the file is directly accessed by a different referer it will hit the same rewrite rule ?

thx :)
Re: Modifying a rewrite rule in nginx for subdomain
January 19, 2011 02:06AM
Anyone ?
Re: Modifying a rewrite rule in nginx for subdomain
January 21, 2011 04:40AM
i can't get an answer to nginx question in an nginx.org's forum. EPIC
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 295
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready