views:

26

answers:

2

Hello, I have a joomla setup in my /home/joomla directory. I installed both Apache and Lighttpd i have configured Lighttpd to proxy only static files, and lighttpd is listening on port 81. Now what i want is

whenever request for static files are made, instead of going to

www.domain.com/whatever/bg.jpg

it should redirect to

domain.com:81/whatever/bg.jpg

using .htaccess

also notice that www.domain.com changed to domain.com

please please i need a quick help for it :)

A: 

try this in your .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(directory)
RewriteRule ^(.*)$ http://domain.com:81/$1 [P,QSA,L]
dejavu
I want only static files which is not neccesarily present in a directory, rewrite codition must check for jpg, css, flv, gif, etc and if itsz true then " RewriteRule ^(.*)$ http://domain.com:81/$1 [P,QSA,L] "
Sunny Rockzzs
even if i change the above toRewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]RewriteRule \.(jpg|jpeg|png|gif|css)$ http://domain.com:81/$1 [P,QSA,L]It returns 404 error......
Sunny Rockzzs
A: 

Alright i found out the way :)

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule \.(jpg|jpeg|png|gif|css)$ http://domain.com:81/$1 [P,QSA,L]

Learned a lot about htaccess files in one day :)

Sunny Rockzzs
Using that kind of condition in mod_rewrite depends on mod_proxy and mod_proxy_http. So make sure both are enabled on the server.
Gorilla3D