Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

369
Views
Rewrite URL /blog/content/images/**/* to /content/images/**/*

My front-end is hitting /blog/content/foo/bar.jpg when looking for static assets.
How can I make NGINX redirect those requests to /content/foo/bar.jpg instead?

At first I tried this:

location ~ ^/blog/content/ {
    root /var/www/ghost/content/;
}

Apparently it didn't work – (btw, I'm testing each change in the .conf file with a sudo nginx -s reload + F5 in the browser.. is there a better way to test/debug NGINX behavior (and actually understand what's going on instead of this "worked / didn't work" feedback I get with each F5?)

Then, I tried this one I found in a cheatsheet – at the server level:

rewrite ^/blog/content/(.*)$ /$1 last;

Again, without luck. What bothers me is that I can't even see what the line above is doing and why it isn't working.

Someone, please, get me out of this "google for a solution -> try something that looks promising --> hit F5 hoping it works (it doesn't) -> google for a solution" loop.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The solution I found was to rewrite with:

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

But it isn't ideal. I'd prefer to rewrite only when the URI contains "/blog/content/"..

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!