.htaccess 重写到另一个端口 [英] .htaccess rewrite to another port

查看:44
本文介绍了.htaccess 重写到另一个端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的/home/joomla 目录中有一个 joomla 设置.我安装了 Apache 和 Lighttpd我已将 Lighttpd 配置为仅代理静态文件,并且 lighttpd 正在侦听端口 81.现在我想要的是

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

www.domain.com/whatever/bg.jpg

它应该重定向到

domain.com:81/whatever/bg.jpg

domain.com:81/whatever/bg.jpg

使用 .htaccess

using .htaccess

还要注意 www.domain.com 更改为 domain.com

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

拜托,我需要一个快速的帮助:)

please please i need a quick help for it :)

推荐答案

好吧,我找到了方法 :)

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]

在一天之内学到了很多关于 htaccess 文件的知识 :)

Learned a lot about htaccess files in one day :)

这篇关于.htaccess 重写到另一个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆