Tag Info

Hot answers tagged

6

I'm assuming that you have two VirtualHosts: VH for WP that hosts *.mydomain.com VH for independant webiste that hosts subdomain.mydomain.com Make sure that your subdomain.mydomain.com VirtualHost is loaded or located in file before the VirtualHost with ServerAlias of *.mydomain.com. Apache will use the 1st VH it finds that matches ServerName/Alias. ...


6

Yes, that should work - the rules for wildcards in ServerAlias don't need to worry about the rules that DNS wildcards follow.


5

Try removing your commas. I've always used spaces to delimit the hostnames (same goes for /etc/hosts as well) http://httpd.apache.org/docs/2.2/mod/core.html#serveralias


4

I'd imagine the rewriting solution gets better SEO-foo (nice term :-P) since it's usually considered best to have one canonical domain that everybody gets sent to for a particular set of content. In other words, having two different domains that produce the same results from the server can split your site rankings between the two domains, reducing the value ...


3

Apache searches for a match in the order that the domains are defined. If I understand you problem correctly then it can be solved by defining your hosts to be excluded before the catch all host. <VirtualHost *:80> ServerName excluded.example.com ServerAlias something.example.com ... ... </VirtualHost> <VirtualHost *:80> ...


2

Turns out the problem was this Apache directive: UseCanonicalName On


2

The browser will still send a Host: userdomain.com header, the CNAME record will not cause a redirect. You will therefore need ServerAlias userdomain.com in your configuration. It is in your application that you will need to associate userdomain.com to the user.


2

Make sure that the order of precedence in configuration directives matches how Apache should handle the request - i.e. you won't have much luck if your directives load like this: example.com default/catch-all universal.lv Doesn't matter whether they are declared in a single file or multiple files - so long as "universal.lv" is last, it will not be ...


1

Here are the relevant bits of the Apache documentation: http://httpd.apache.org/docs/trunk/mod/core.html#if and http://httpd.apache.org/docs/trunk/expr.html In that case, something like this should work: <If "%{HTTP_HOST} == 'example.com'"> Alias /sub /var/www/other </If> I believe you will need Apache 2.2 or greater for the "If" ...


1

Nope, there is no solution if you do not have access to httpd.conf. The reason is that is where Apache checks every time it gets a request - it is not delegated elsewhere. If it fails to find a match, it will give up, and return a default page. There is no way to work around this, I'm afraid. On the other hand, many hosts are more than willing to make such ...


1

Make sure your more specific prerelease rule is above the catchall rule as the Apache configuration is processed. Apaches conf.d directory is processed in lexographic order.


1

Your definitions seem totally correct to me. However this rather sounds like a DNS issue. Depending on your host, try refresh you DNS cache (depending on your OS) and check if sub1.mysite.com matches the IP of your VM.


1

I would probably do both. With something like: <VirtualHost 111.22.33.44:80> ServerName subdomain.site.com #Using Wildcard: might as well handle any variation #such as ww.subdomain.site.com (remember to set this in DNS too) ServerAlias *.subdomain.site.com RewriteEngine On #Change all variations to the Canonical hostname for SEO. ...


1

Has DNS propigated? For me, galengrover.com 301 redirects to www.galengrover.com. skatevideosonline.com is a spam blog. skatevideosonline.net shows content from www.galengrover.com but skatevideosonline.net isn't a ServerAlias in the configuration you posted... Did you mean ServerName www.skatevideosonline.net ServerAlias skatevideosonline.net instead ...


1

Remove the ServerName directive outside of your <VirtualHost> blocks.


1

You can include arbitrary configuration settings from an external file using the Include directive in place of the actual option you want to pull in from a file. (there is also a mod_perl option, if you are an old-skool perl wizard ;-) 1. use the Include directive, to include a list of ServerAlias from a text file in conf.d/mydomain.conf like so; ...


1

ServerAlias directive can be defined in virtual host context but not in htaccess. VirtualHost directive can only be defined in server config context. The httpd-vhosts.conf is linked/included into main config file and therefore part of the server config context. P.S. xampp uses Apache as web server, so you will have Apache in both places anyway. If you ...


1

So I have successfully aliased the client's domain to my own server. Here is how: In your vhosts.conf file create an alias to a fake subdomain to your clients site. For example if your client is www.myclient.com create local.myclient.com or something: <VirtualHost *:80> ServerAdmin admin@mydomain.com ServerName dev.mydomain.com ...


1

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 ...


1

Standard SSL certificates are valid on a single domain only. Please see my overview of SSL certificate types here: http://serverfault.com/a/509303/35258 Either you want to use a multi-domain SSL certificate or consider creating two-virtual host containers and using a SSL certificate on each that matches their respective domains.



Only top voted, non community-wiki answers of a minimum length are eligible