I have started to learn the F3 framework (PHP) and I have gotten the Hello World program running.
However, I am facing a problem which is simple but I can’t seem to get what am I doing wrong. When I keep the index.php file on the web root directory(/var/www) with the routing as –
F3::route('GET /', 'home);
and access http://localhost, I am getting the correct output. However, if I place the index.php file on the path /var/www/my_test/ and change the routing as follows-
F3::route('GET /my_test/', 'home')
and access http://localhost/my_test/ I get that the URL does not exist.
What am I missing here?
Hopefully you have been able to figure this out but if not, I hope I can help.
The
.htaccessfile is what points to theindex.phppage. If you change the location of theindex.phpfile, you will need to modify your.htaccess. This is only if you change just the location of theindex.php.If you move the entire contents to a subfolder, I believe that folder becomes the BASE. So if you put the entire framework into
/var/www/my_test/then/my_test/is the BASE and anything after that slash will be processed by the framework.http://localhost/my_test/will be routed by usingF3::route('GET /','home');andhttp://localhost/my_test/abcwill be routed by usingF3::route('GET /abc','abc');.You may still have to modify the
.htaccessfile for the folder, but I am not sure. On my computer, I created a virtual host so I could play around with it. Good luck!