.htaccess rewrite to another port

12,217

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 :)

Share:
12,217
Subho Halder
Author by

Subho Halder

I'm a Security Researcher, Web Developer, Programmer, and a Human after all. I have co-founded Appknox, Android Framework for Exploitation(AFE) and many other initiatives and also worked as a freelancer in Scriptlance. Find me at Apple Security Researcher List, Microsoft Security Researcher's List and also at Google Hall of Fame, Under Honourable mention. Currently I am the Co Founder of Appknox a Mobile Security Startup. I have completed my Bachelors in Electronic and Telecommunication from KIIT University. You can read my blogs at http://subho.me A budding programmer, hacker and a Party Harder kind of guy :)

Updated on July 08, 2022

Comments

  • Subho Halder
    Subho Halder almost 2 years

    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 :)