document-root

Path of current PHP script relative to document root

匆匆过客 提交于 2019-12-05 02:50:40
TL;DR : What alternatives to the last code sample on this page are there when trying to use relative links on pages included with PHP's include command? I'm trying to include() a file that links to a .css document, the problem is that I need to include this file from multiple (different) directories. My directory structure looks somewhat like this: www ├── (getpath.php) │ ├── css │ └── style.css ├── php │ └── header.php └── content ├── index.php └── posts └── index.php (I'm including header.php in both index.php files. header.php is the file that refers to style.css (which the browser needs to

Git: How to manage a website with Git? How to use Git for a website -deployment?

对着背影说爱祢 提交于 2019-12-04 18:32:33
Originally, I thought my problem was How to maintain branches in Apache's DocumentRoots? but realized the right question actually is How to use Git to deploy stuff to web -server such as Apache? . I feel I have understood now the DocumentRoot -problem, it would require Apache hacking that I want to avoid because much simpler solution using side-effects and putting the repo outside the deployment -dir but now a problem to understand git-fetch-hook and how to deploy stuff if the outside thing is a large dir, perhaps just cp besides and then mv -- but there must be some better way of syncing the

PHP: How to get the document root from inside a user directory?

天大地大妈咪最大 提交于 2019-12-04 18:15:08
I develop and deploy various PHP applications to different environments. Especially on development environments, they can be anywhere, from document_root to /Users/me/Sites/ or even /Users/me/Sites/someapp/ Inside these applications I need to know where the 'application root' is, once as the real path and once as URL. Path is no problem. Let's say I have a bootstrap.php in the app root directory which does: define("BASE_DIR", realpath(dirname(__FILE__))); However, I have problems to reliably get the base URL. On most environments simply subtracting document root from BASE_DIR works: define(

Differences in declaring your root directory in HTML

懵懂的女人 提交于 2019-12-03 16:28:11
This has been bugging me for a long time so I need to ask the question. What is the difference between / and ./ , is it just down to server settings? For example, if we were looking for an images folder in the root directory we would write: <img src="/images"> However, another server will only accept it as follows: <img src="./images"> It's not a biggie, but in an ideal world I'd like to think I could transfer my sites to another server relatively easily without having to update minor details like these. Of course, I can declare it in PHP and set it once in a config file, but it really is

javascript site root

怎甘沉沦 提交于 2019-12-03 12:10:21
问题 I have this site that I need to find the root folder / plus the actual folder its works out of. My problem here is that during development i have the folder with in my local server that in turn is with in its own folder: Then online I then have the development site within a folder, so it can all be tested before the live production etc. LOCAL SERVER: localhost/mytestSiteA/... LIVE SERVER TEST FOLDER: www.asite.com/devbuild/.... Now I can retrieve the root via the document.location.hostname

ProxyPass and DocumentRoot on one domain

三世轮回 提交于 2019-12-03 10:05:10
Let's say I have the following configuration: <VirtualHost domain.com> # Server names, admins, logs etc... ProxyVia On ProxyRequests Off <Location "/"> ProxyPass http://localhost:8080/tomcat-webapp/ ProxyPassReverse http://localhost:8080/tomcat-webapp/ Order allow,deny Allow from all </Location> </VirtualHost> Now, I want the address domain.com/forum to display conent of my MyBB forum, which files are inside /var/www/forum directory. How to accomplish this? Actually, I resolved this problem with the following code: ProxyPass /forum ! ProxyPass / http://localhost:8080/tomcat-webapp/

What is the best way to hide a websites folder/ directory files [duplicate]

*爱你&永不变心* 提交于 2019-12-03 07:55:12
问题 This question already has answers here : Hide folders with .htaccess (9 answers) Closed 6 years ago . If I would visit my website by "www.mysite.com/img/" I would see the following: Parent directory... folder1 folder2 file1 file2 etc etc.. But what is the best way to prevent people from visit my websites folders and file structure? While still letting pople view eg the images on the actual website I also want to hide eg www.mysite.com/functions/ where I have my php function-files. Checking on

You don't have permission error in Apache in CentOS

こ雲淡風輕ζ 提交于 2019-12-03 07:50:33
I have installed apache 2.2 in centos 6. Everything worked fine when the apache folder was at its default location /var/www/html . Then I configured a Virtual host inside my users home folder. After that apache started showing Forbidden You don't have permission error when I tried to go to localhost or 127.0.0.1 from browser. this is the code i used in httpd.conf <VirtualHost *:80> DocumentRoot "/home/anjan/workspace/mfs" ServerName anjan-centOS <Directory "/home/anjan/workspace/mfs"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order Deny,Allow Allow from all </Directory> <

javascript site root

风流意气都作罢 提交于 2019-12-03 02:39:12
I have this site that I need to find the root folder / plus the actual folder its works out of. My problem here is that during development i have the folder with in my local server that in turn is with in its own folder: Then online I then have the development site within a folder, so it can all be tested before the live production etc. LOCAL SERVER: localhost/mytestSiteA/... LIVE SERVER TEST FOLDER: www.asite.com/devbuild/.... Now I can retrieve the root via the document.location.hostname But i need then to add the folder name after this so that I can load in content etc when in developement

Apache multiple DocumentRoot

杀马特。学长 韩版系。学妹 提交于 2019-11-30 06:24:08
How can I have the following setup in apache? http://server/ABC/* should be served by /var/www/ABC/* http://server/PQR/* should be served by /var/www/PQR/* Every other request should be served by /var/www/Others/index.php (a single file). Thanks, JP Use Alias: Alias /ABC/ /var/www/ABC/ Alias /PQR/ /var/www/PQR/ Leave the document root pointing to /var/www/Others/index.php. It could do the trick. :) You can do this with mod_alias, which is part of the apache distribution. http://httpd.apache.org/docs/current/mod/mod_alias.html for serving everything else with the single file you would use mod