Question

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?

Was it helpful?

Solution

Hopefully you have been able to figure this out but if not, I hope I can help.

The .htaccess file is what points to the index.php page. If you change the location of the index.php file, you will need to modify your .htaccess. This is only if you change just the location of the index.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 using F3::route('GET /','home'); and http://localhost/my_test/abc will be routed by using F3::route('GET /abc','abc');.

You may still have to modify the .htaccess file 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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top