I am working on a project using WAMP. The vhost
is configured like this:
<VirtualHost *:80>
ServerName LearningPHP
DocumentRoot c:/wamp64/www/learning_php/public/page/
<Directory "c:/wamp64/www/learning_php/public/page/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
The Windows host
file looks like this:
127.0.0.1 LearningPHP # Project wamp64/www/learning_php
::1 LearningPHP # Project wamp64/www/learning_php
The project structure looks like this:
I am trying to achieve this:
- when I access the website to land on
learning_php/public/page/index.php
(I think I accomplished this through thevhost
configuration); - inside each folder under
page
directory (e.g.login
,profile_add
etc.) there are two files:index.php
andprocess.php
. I used this approach to organize my project better (I am not yet familiarized with theMVC
pattern); - inside the
css
andjs
folders the name of the files matches the name of the folder under thepage
directory (e.g.page > profile_add
=>css/profile_add.css
orjs/profile_add.js
). Later on I will merge allcss
andjs
files a page needs into individual files to limit the HTTP requests;
The problem I am experiencing:
- I cannot figure out how to include the
css
andjs
files. I think this happens because I rewrite theDocumentRoot
in thevhost
configuration.
I tried answers from similar questions using PHP
constants, but I could not figure out what the issue is. For instance, I tried to add this <link rel="stylesheet" type="text/css" href="../public/css/style.css">
to the index.php
under the page
folder and it did not work. I also used the file location on disk, but no result.
I would really appreciate any help.