add a server alias to the domain's VHOST?
Question
I have a VPS. I hosted a domain ipointing to a sub directory of the www folder. The domain works fine till the home page. The moment I start going to other pages its shows my servers [orginalname]/[subdirectory name] . I think I need to add a server alias to the domain's VHOST. Can anyone tell me how to do that??
Solution
Are you using Apache? Try with
<VirtualHost *:80>
DocumentRoot "/path/to/document/root"
ServerName name1
ServerAlias name2
...
OTHER TIPS
I did it using the proxy Apache option, this is it:
My VirtualHost is http://dlx/
and I want to add an "alias" like http://dlx/drupal/
In the httpd.config
file I added a proxy configuration:
<VirtualHost 127.0.0.1>
ServerName dlx
DocumentRoot "C:/deluxe/"
<LocationMatch /drupal/>
ProxyPass http://localhost/drupal/
ProxyPassReverse http://localhost/drupal/
</LocationMatch>
</VirtualHost>
Configure .htaccess on my dlx virtualhost (C:/deluxe/
):
RewriteRule ^drupal/(.*)$ http://localhost/drupal/$1 [P,L]
That's it. It works for me, I hope it also works for you.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow