Different folder as website subfolder

限于喜欢 提交于 2019-11-29 21:34:43

www.site.com (points to /var/www/zf)

www.site.com/blog (points to /var/www/wp)

The easiset way to achive this, where you want a sub-url to point outside the VirtualHost's DocumentRoot directory, is to create an Alias...

Inside the VirtualHost block add:

Alias /blog /var/www/wp

<Directory /var/www/wp>
    Options All
    AllowOverride All
    order allow,deny
    allow from all
</Directory>

*This assumes you have PHP enabled in some way for that directory.

The ServerName trick will not work: you can not have path names in a ServerName directive.

For mod_rewrite you should be able to get away with something like this:

RewriteEngine on
RewriteBase /
RewriteRule ^blog/(.*)$ wp/$1 [L]
RewriteRule ^(.*)$ zf/$1 [L]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!