大网数据广告活动
服务器运维问答

Apache Virtual Hosts .. Redirect .. ProxyPass .. and Alias

· 52CE 我爱测

I have tried just about everything and am looking for help the with below... We are currently doing a Redirect with a Proxypass, however I would like to create a alias and point everyone there instead of the Proxypass. Currently …

问题原文

原帖链接 · kmeyers · CC BY-SA 3.0

I have tried just about everything and am looking for help the with below... We are currently doing a Redirect with a Proxypass, however I would like to create a alias and point everyone there instead of the Proxypass.

Currently when you go to server.org it redirects to -> server.org/test/ which is proxy'd -> localhost:8080/test/

I would like to create an alias /mm so that either server.org/mm/ or server.org/test/mm/ will be redirected to the alias provided.

Is this possible?

I have tried (ProxyPass /mm !) with no luck

Thanks in advance!

DocumentRoot "/var/www/html"
Redirect "/" "https://server.org/test/" 

Alias /mm "/var/opt/mm"

<Directory "/var/opt/mm">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /test/ http://localhost:8080/test/
ProxyPreserveHost On
ProxyStatus On        

社区高分解答

原帖链接 · Froggiz · CC BY-SA 3.0

This should works:

DocumentRoot /var/www/html
Redirect (!/mm) https://server.org/test/

Alias /mm "/var/opt/mm"
Alias /test/mm "/var/opt/mm"

<Directory "/var/opt/mm">
    Options Indexes FollowSymLinks
    AllowOverride All
</Directory>

ProxyRequests Off
ProxyPreserveHost On
ProxyStatus On  

ProxyPass /test/mm !
ProxyPass /test/ http://localhost:8080/test/

if you are sure /mm is unique in the url you can change

Alias /mm "/var/opt/mm"
Alias /test/mm "/var/opt/mm"

by

AliasMatch /mm "/var/opt/mm"

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。