0

In Debian I am trying to move a wiki site that is on a subdomain of my main site to the sites path: wiki.mysite.com to mysite.com/wiki.

I had two dns records: wiki.mysite.com and mysite.com and also had two conf files under apache:

  • wiki.mysite.com.conf

  • mysite.com.conf

And had the website directories:

  • /var/www/html/www.mysite.com

  • /var/www/html/www.wiki.mysite.com

Everything was working well. I now need to move the wiki site underneath the path of the main site to www.mysite.com/wiki... I have attempted to make the following updates to mysite.com.conf, but after restarting apache I am getting a "Not Found: The requested URL was not found on this server" when trying to access mysite.com/wiki (but mysite.com works fine). I HELP. WHAT DO? :

<VirtualHost *:80>

Server Admin webmaster@localhost
ServerName mysite.com
ServerAlias www.mysite.com

DocumentRoot /var/www/html/www.mysite.com

<Directory /var/www/html/www.mysite.com/>
AllowOverride All
</Directory>
<VirtualHost>

<VirtualHost *:80>
Server Admin webmaster@localhost
ServerName mysite.com/wiki
ServerAlias www.mysite.com/wiki

DocumentRoot /var/www/html/www.wiki.mysite.com

<Directory /var/www/html/www.wiki.mysite.com/>
AllowOverride All
</Directory>

<VirtualHost>

I have only added the second virtual host, the first was there originally when i had the site an subdomain site setup. To repeat myself the first virtual host still works.

1 Answer 1

0

What you're looking for is the alias entry. Alias will specify an alternate location for a give subpath of the URL. You don't want multiple virtual hosts for this.

This is the apache documentation for alias. The info below is from there:

The directives contained in this module allow for manipulation and control of URLs as requests arrive at the server. The Alias and ScriptAlias directives are used to map between URLs and filesystem paths. This allows for content which is not directly under the DocumentRoot served as part of the web document tree.

Please keep in mind that if the website docs in www.wiki.mysite.com ever references absolute urls, for example a link that points to /index.php. This will go to mysite.com/index.php, not mysite.com/wiki/index.php.

<VirtualHost *:80>

Server Admin webmaster@localhost
ServerName mysite.com
ServerAlias www.mysite.com

DocumentRoot /var/www/html/www.mysite.com
Alias /wiki /var/www/html/www.wiki.mysite.com

<Directory /var/www/html/www.mysite.com/>
    AllowOverride All
</Directory>

<Directory /var/www/html/www.wiki.mysite.com/>
    AllowOverride All
</Directory>

</VirtualHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .