I have Rails installed for example.com
, however, I want to use WordPress for my blog as well. So I want example.com/blog
to be WordPress. The problem is, I want to have WordPress in a separate directory from the Rails, such as /srv/www/example-wp
and have Rails in /srv/www/example-ruby
. How can I separate this? I think it has something to do with virtual hosts, but I am unsure how this is supposed to work.
Update:
<VirtualHost ip:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example-ruby/public/
Alias /blog /srv/www/example-wp/public/
<Directory /srv/www/example-wp/public/>
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Directory /srv/www/example-ruby/public/>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
You are looking for the "Alias" function in Apache.
The Alias function allows you to "map" users to a sub-directory outside of the document root.
You would use it like so:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html
Alias isn't enough on its own ... the home page and Dashboard work, but no actual post URLs. AliasMatch is required.
via Yii2x