Score:1

How to create alias to url in Apache 2

fr flag

I have main url like http://apps1.example.com and i want create alias like http://apps1.example.com/svc-base

in my vhost config

<VirtualHost *:80>
 ServerName apps1.example.com

 ProxyPreserveHost On

 ProxyPass / http://123.456.7.8:880/
 ProxyPassReverse / http://123.456.7.8:880/
 
 Alias /svc-base !
 ProxyPass /svc-base http://123.456.7.9:881/

 ProxyRequests     Off
 AllowEncodedSlashes NoDecode
</VirtualHost>

When access from browser the url http://apps1.example.com/svc-base just redirect to main page of http://apps1.example.com/ what's wrong with my code? need advice thanks before :)

Score:0
la flag
Alias /svc-base !

Usage for the Alias directive is:
Alias [URL-path] file-path|directory-path

An exclamation mark ! is, as far as I know, not a valid syntax for the Alias directive (unless you're actually matching to a file/directory named /!).

(Maybe you're confused with the fact that the exclamation mark ! can be used in conjunction with a ProxyPass directive in situations where you don't want to reverse-proxy a subdirectory and exclude a path that would be otherwise matched by a ProxyPass.)

What I think you're trying to achieve though, does not require an Alias anyway.


It appears that you want to ProxyPass /svc-base to a different back-end server than the root URL ProxyPass /.

That is achieved by changing the ordering of the ProxyPass directives, as ProxyPass rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first.

 ProxyPass /svc-base http://123.456.7.9:881/
 ProxyPassReverse /svc-base http://123.456.7.9:881/ 

 ProxyPass / http://123.456.7.8:880/
 ProxyPassReverse / http://123.456.7.8:880/
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.