Different folder as website subfolder

后端 未结 2 1013
被撕碎了的回忆
被撕碎了的回忆 2020-12-13 04:56

I need some help with URL rewriting. The case is similar with this one.

I have a working Zend Framework site. Now I must add a blog in Wordpress (also working). I\'v

相关标签:
2条回答
  • 2020-12-13 05:33

    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.

    0 讨论(0)
  • 2020-12-13 05:44

    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]
    
    0 讨论(0)
提交回复
热议问题