开发者

Drupal symbolic link to another directory outside Drupal

开发者 https://www.devze.com 2023-02-13 00:31 出处:网络
I have a multi-site Drupal setup http://mysite.comwhich is开发者_如何学C in /home/drupal I want the path http://mysite.com/iphone/ to point to a directory outside of Drupal on my server /home/iphone.

I have a multi-site Drupal setup http://mysite.com which is开发者_如何学C in /home/drupal

I want the path http://mysite.com/iphone/ to point to a directory outside of Drupal on my server /home/iphone.

Here is the entry in the vhost file:

<VirtualHost 192.168.100.244:80>             
    ServerAdmin serveradmin@mysite.com                  
    DocumentRoot /home/drupal       
    ServerName mysite.com
    ServerAlias mysite.com www.mysite.com www.mysite.com mysite.com
    ErrorLog /var/log/httpd/mysite5_err_log
        CustomLog /var/log/httpd/mysite5_log special
    <Directory /home/drupal>
                Options FollowSymLinks +Includes ExecCGI       
                AllowOverride All
                DirectoryIndex index.html index.htm index.php
    </Directory>            
</VirtualHost>

Is this done with a symbolic link or in the vhost file or Apache setting? How can this be done?

thanks


I found out how to do it. I'm posting an example here to help anyone else out.

You need to edit the vhosts file at /etc/httpd/conf/vhosts.conf and add an Apache Alias directive for that domain.

<VirtualHost 192.168.100.245:80>
    ServerAdmin serveradmin@bbgi.com
    DocumentRoot /home/drupal
    ServerName mysite.com
    ServerAlias www.mysite.com mysite.com
    Alias /iphone/ /home/iphone/
    ErrorLog /var/log/httpd-www1/www2/be_err_log
    CustomLog /var/log/httpd-www1/www2/be_log special
    <Directory /home/drupal>
                Options FollowSymLinks +Includes ExecCGI
                AllowOverride All
                DirectoryIndex index.html index.htm index.php
    </Directory>
</VirtualHost>

The line that I added is:

Alias /iphone/ /home/iphone/

If I wanted an alias for ALL websites on the server when going to http://mysite.com/iphone/ to point to /home/iphone You need to edit the /etc/httpd/conf/httpd.conf file and add this line:

AliasMatch ^/iphone/(.*) /home/iphone/$1 


You need :

  • a symbolic link (with apache option FollowSymLinks)
  • or an alias : http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号