Page 1 of 1

Using D drive to keep website outside htdocs

PostPosted: 09. May 2020 11:28
by fuzmic
Hi members

As we know, if we place in httpd-vhosts.conf the following virtual host, it will pick up the website in c:\xampp\htdocs\cye and expose it ok.
<VirtualHost *:80>
ServerName cyeOne
DocumentRoot "c:/xampp/htdocs/cye"
</VirtualHost>

However if place the website in eg D:/www/cye and use the following conf
<VirtualHost *:80>
ServerName cyeTwo
DocumentRoot "D:/www/cye"
</VirtualHost>

When we browse for cyeTwo it will report following error
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403

Hosts file correctly set. How to fix this? :D

Re: Using D drive to keep website outside htdocs

PostPosted: 09. May 2020 13:34
by Altrea
Missing access rule.

XAMPP comes with a access rule for the htdocs folder already (and some others). If you don't use htdocs or a subfolders of it, you need to define your own access rule, for example inside your vhost defination.

I have already shown you one example in your other thread.

Re: Using D drive to keep website outside htdocs

PostPosted: 09. May 2020 15:07
by fuzmic
Altrea you mean following

httpd.conf [C:\__Server\apache\conf] . though some says there are security risks with this but couldn't find a way without this

<Directory />
AllowOverride none
Require all granted
</Directory>

Re: Using D drive to keep website outside htdocs

PostPosted: 09. May 2020 15:31
by Altrea
No!

I mean this
Code: Select all
<VirtualHost *:80>
   ServerName local.cye
   DocumentRoot "D:/xampp7230/vhost/local.cye"
   <Directory "D:/xampp7230/vhost/local.cye">
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>

Re: Using D drive to keep website outside htdocs

PostPosted: 09. May 2020 16:04
by fuzmic
Yes sir

Re: Using D drive to keep website outside htdocs

PostPosted: 10. May 2020 06:15
by fuzmic
Altrea friend: Just closing messages

Of course your advice work linking to D: drive without the error response. For for my understanding which of the following 3 lines did the trick.
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted

In my earlier thread i made some mistakes in the post. I now realise that browsing localhost must end up in the dashboard to be able to use the menu option "phpAdmin"

Thanks again.

Re: Using D drive to keep website outside htdocs

PostPosted: 10. May 2020 11:38
by Altrea
Require all granted is the access rule.
You can read more about it here: https://httpd.apache.org/docs/2.4/mod/m ... ml#require

fuzmic wrote:Options Indexes FollowSymLinks Includes ExecCGI

Read more about it here: https://httpd.apache.org/docs/2.4/mod/core.html#options

fuzmic wrote:AllowOverride All

Read more about it here: https://httpd.apache.org/docs/2.4/mod/c ... owoverride

Re: Using D drive to keep website outside htdocs

PostPosted: 11. May 2020 06:51
by fuzmic
Thanks for the leading light. Closed this post, this project is done. Good!