Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to add a ServerAlias pointing to a url say "www.example.com/somthing/more". I know this is perfectly possible in case of "www.example.com" or "*.example.com" for eg.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

TL;DR;

No.


Server[Name|Alias] accepts hostnames only.

To go beyond hostnames, you need to look into <Location>, Alias, Rewrite directives or the like.

If you had foo.example.com and wanted to redirect to http://bar.example.com/directory, then you could do something like this:

<VirtualHost *:80>
    ServerName foo.example.com
    RewriteEngine on
    RewriteRule .* http://bar.example.com/directory [R=301,L]
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.