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.


Apache is not processing urls for server aliases.


I am trying to set up a wordpress multisite (a feature of wordpress 3.+ which allows to host multiple blogs at once). The main domain is yeloblog.com Then I want to map domains to the sub-blogs. In other words, I want xananax.com to serve xananax.yeloblog.com.
Things is, permalinks (this is how wordpress calls SEO-friendly urls) don't work in mapped domains. I spend days trying to fix wordpress, until I replaced the index.php file with the following:

echo '<pre>';
echo 'Server Name: '.$_SERVER['SERVER_NAME']."\n";
echo 'Request URI: '.$_SERVER['REQUEST_URI']."\n";
echo 'Redirect URL: '. $_SERVER['REDIRECT_URL']."\n";
echo '</pre>';

And discovered that I would have the same results: xxx.yeloblog.com/some/test/url would work, but xananax.com/some/test/url would yield a 404 page. So this has nothing to do with wordpress.

For test purposes:

  1. whatever.yeloblog.com/some/test/url
  2. xananax.yeloblog.com/some/test/url
  3. xananax.com/
  4. xananax.com/some/test/url (should give same result as #2, but gives 404)

What should I do?

Here are the relevant configuration files: Apache conf:

<VirtualHost *:80>
    ServerAdmin root@localhost
    ServerName yeloblog.com
    ServerAlias *.yeloblog.com
    ServerAlias *.rassapark.com
    ServerAlias *.yelostudio.com
    ServerAlias *.xananax.com
    ServerAlias *.sabinecuisine.com

    DirectoryIndex index.html index.htm index.php
    DocumentRoot /my_root/

    RewriteCond %{HTTP_HOST} ^www.yeloblog.com$ [NC]
    RewriteRule ^(.*)$ http://yeloblog.com/ [R=permanent,L]

    <Directory /my_root>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all

and .htaccess:

Options +FollowSymlinks +Indexes

#Wordpress Multi site
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

#END WordPress Multi Site

I tried mapping the domains in two different ways:

  1. through the domain mapper plugin
  2. by following the instructions in this post

In both cases, the process is the same:

  • wildcard matching on serveralias
  • wordpress takes care of redirection

In both cases, the result is the same: the domains are correctly mapped, and calling the posts through GET (ex: xananax.com/?p=123) works, but rewritten urls (xananax.com/2011/mm/dd/post_name) stop working (although they do work on non-mapped domains, e.g. accessing the same post through xananax.yeloblog.com/2011/mm/dd/post_name).

share|improve this question
You didn't mention how are you mapping domain's to blogs? Also the .htaccess you are using is the default htaccess for subfolder multisite environment. –  Hameedullah Khan Dec 29 '11 at 11:32
I tried both htaccesses; it does not make a difference (but I reverted to the other one and changed it in the question because it is indeed confusing). I also tried mapping in two different ways (question updated, see above) –  Xananax Dec 29 '11 at 14:21
Anything useful or interesting in the error or access logs when it 404s? –  Shane Madden Dec 29 '11 at 17:01
The error log, when I try to access /some/url, states: [File does not exist: /var/www/some]...Which is quite weird; First, it's not picking the rewrite; second, the root for this domain is "/home/sitename/www/"; I have no site set up in var/www. It is as if instead of using the serveralias for the domain, apache is reverting to the '000-default' file –  Xananax Dec 30 '11 at 12:00
Fixed!!!! I added a virtual host (NOT a serveralias) pointing to the same document root, and it works! I will post my answer here, but before I would really love if I could explain why it works. Anyway thanks for the pointer to look in the logs! I had taken a peek before but they were so huge I felt discouraged. Your comment prompted me to take a long cold stare at them. –  Xananax Dec 30 '11 at 12:11

Your Answer


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

Browse other questions tagged or ask your own question.