Nginx: Remove part of the url -


i'm looking right rewrite rule nginx server. remove specific part of url.

an example:

example.com/assets/files -- real location

to

example.com/files

and

example.com/assets/files/image.jpg

to

example.com/files/image.jpg

and

example.com/assets/themes/css/style.css

to

example.com/themes/css/style.css

i have googled it, none of salutations found worked me. got 500 errors.

so rewrite rule need , should put in conf file. thank you!

according have posted in question. can figure out try rename url, without changing exact location of file.

for achieving this, add these in server directive:

#example :  #rewriting example.com/themes -> example.com/assets/themes location /themes {     rewrite ^/.* http://$server_name/assets/themes permanent; } location /files {     rewrite ^/.* http://$server_name/assets/files permanent; } 

now user opening eg: http://example.com/files/image.jpg, , file on server placed @ location /var/www/..something.../example.com/assets/files/image.jpg

hope helps..! :)


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -