2

I have configuration like this:

    Alias /blog /usr/share/wordpress
    Alias /blog/wp-content /var/lib/wordpress/wp-content
    <Directory /usr/share/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
    </Directory>
    <Directory /var/lib/wordpress/wp-content>
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>

In general I follow up this procedure help.ubuntu.com. Problem is in fact when I restart apache2 I get message

"The Alias directive in /etc/apache2/sites-enabled/wordpress at line 2 will probably never match because it overlaps an earlier Alias."

I had been added on test.php file on /var/lib/wordpress/wp-content. If I try mydomain.com/blog/wp-content/test.php, I got error 404. This means that in general I miss all plugins/themes static files.

What could be a fix for it?

1
1

Swap the order of those Alias directives so the most specific one comes first:

Alias /blog/wp-content /var/lib/wordpress/wp-content
Alias /blog /usr/share/wordpress

From the docs:

[...] the Aliases and Redirects are processed in the order they appear in the configuration files, with the first match taking precedence.

For this reason, when two or more of these directives apply to the same sub-path, you must list the most specific path first in order for all the directives to have an effect. For example, the following configuration will work as expected:

Alias /foo/bar /baz
Alias /foo /gaq

But if the above two directives were reversed in order, the /foo Alias would always match before the /foo/bar Alias, so the latter directive would be ignored.

-1

Add

ServerName mydomain.com

ServerAlias www.mydomain.com

on the top of the conf file

3
  • -1, The ServerAlias directive is different from the Alias directive which the OP asking about – Dan Mar 5 '14 at 14:50
  • Dan, could u please explain? – Midhun Varghese Mar 5 '14 at 14:52
  • 1
    In brief, ServerAlias is used to allow multiple URLs for the same Virtual Host. While Alias is used to allow a domain of a vritual host to access a directory outside its DocumentRoot path – Dan Mar 5 '14 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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