Constantine
Constantine

Reputation: 510

redirect static files to nginx using .htaccess

I'm running nginx for static files(images, scripts) on 81 port and apache with php on 80. Is it possible to redirect with .htaccess all iamges, styles, scripts requests to the same url but 81 instaed of 80 port?

I'm not very familiar with mod_rewrite

something like if mysite.com/path/file.xxx has extension jpg or png or css
then redirect to mysite.com:81/path/file.xxx

thanks!

Upvotes: 0

Views: 740

Answers (1)

Mark Rose
Mark Rose

Reputation: 981

Normally you would do it the other away around: have Nginx proxy anything that's not a static file to a backend Apache. Having Apache look at all the incoming requests would defeat the purpose, since you use Nginx to avoid the inefficiencies of Apache when handling numerous requests. http://kbeezie.com/view/apache-with-nginx/ is a reasonable guide to the setup.

Upvotes: 2

Related Questions