Mobile app version of vmapp.org
Login or Join
Sherry384

: How do I rewrite URL's for a subdirectory of a site? I host a mirror of the Textfiles archive, on http://subdomain.example.com/ Part of this mirror is a mirror of pinouts.ru, located on http://subdomain.example.com/mirror/pi

@Sherry384

Posted in: #Nginx

I host a mirror of the Textfiles archive, on subdomain.example.com/
Part of this mirror is a mirror of pinouts.ru, located on subdomain.example.com/mirror/pinouts.ru/
As you can see subdomain.example.com/mirror/pinouts.ru/ (and its subpages) look pretty crappy.
This is because all links to css, images, etc in these pages are absolute. A good example is the stylesheet of the main page. The link points to /style.css, which attempts to retrieve subdomain.example.com/styles.css (instead of subdomain.example.com/mirror/pinouts.ru/style.css)
Is it possible to configure nginx in such a way that it rewrites these URL's?

(pinouts.ru is just one of several mirrors where I have this issue)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sherry384

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

Location ~ /styles.css {
rewrite /pinouts.ru/style.css permanent;
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme