Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let's say a user tries to access a given image on my website using the following url: http://www.mywebsite.com/blog/image1.jpg?someParam=100

i need a rewrite rule to this, removing the 'blog' node from the path:

http://www.mywebsite.com/image1.jpg?someParam=100

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Try this one:

location /blog {
 rewrite ^/blog(/.*)$ $1 last;
}

If you need this for more than one site you can't just put it higher in hierarchy because "location" clause can't be specified globally, only for specific site. If you need to add this clause for two sites or more you can put it another config file and then just "include" it in each site that needs this redirection.

share|improve this answer
    
This works for in the same server. How to make it work for the different domain? –  Millisami May 6 '13 at 9:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.