php - How to create a share folder for multiple domains on Dreamhost -
i have virtual private server dreamhost. i'm trying create shared folder of domains can access. in folder i'd put php classes, , static files javascripts.
i've created directory on same level domain folders. i'd call file via this... /home/username/shared/file.php
. isn't working however, , i'm hoping magic (like .htaccess maybe) make work.
edit: oops, ok, able include php files using method above. how can include static files javascript, css, images, etc same directory?
this works:
<?php include('/home/username/shared/file.php'); ?>
this doesn't work:
<link rel="stylesheet" type="text/css" href="/home/username/shared/reset.css" media="screen" />
alternatively, realize place static files inside of domain, , point them, i'd know how make other configuration work.
you should happy <link rel="stylesheet" type="text/css" href="/home/username/shared/reset.css" media="screen" />
did not work. if would, have great security hole.
the correct way make symlibk shared directory in document root, or using aliases.
the symlink method
run following in shell:
ln -s /home/username/shared /home/target/
it'll create symlink named /home/target/shared
, pointing /home/username/shared
. might need add options +followsymlinks
directive server config (or .htaccess
file)
the alias method
this method requires change in server configuration (e.g. httpd.conf). add alias
directive it:
alias /shared /home/username/target
note: used requests through server (e.g. http://example/shared/reset.css
), , not php files. within php files, have use full path (/home/username/shared/file.php
)
which method choose you. latter easier configure not have worry permissions / ownership. former used if need use /home/target/shared/file.php
.
Comments
Post a Comment