Hi, so I'm still doing the php practitioner course and I'm currently focussing on the refactoring - lesson 16. I have the following file as my .htaccess
RewriteEngine On RewriteBase /lessons/ RewriteRule ^.*$ index.php [END]
and within my httpd-vhost.conf I have the following:
VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/lessons"
RewriteEngine On
RewriteRule ^(.*)$ /index.php/
</VirtualHost>
The issue I'm having is that when I go to localhost/about.php it's loading the index.php file. I'm not too sure why this is. I am using XAMPP.
@bugsysha thanks! I'm on a windows laptop so will need to set up a VM. Do you know of any solid tutorials to teach me that are error proof. I've been stuck on this for nearly 2 weeks and keen to resolve :)
@vk_monitor consider breaking away from Windows and installing Linux on your laptop directly. Or at least do it through Docker (not sure if Windows has Docker, but no reason not to support it).
Regarding your problem, I'm not sure what are you trying to achieve. Are you using Laravel? If it is Laravel, then I suggest switching from Apache to Nginx. Even the official documentation has only the Nginx configuration covered.
@vk_monitor You may want to try Nginx. I use Nginx, Mariadb, and PHP on Windows with no problems.
I do not use an xampp, I install the packages direct, (zip version). All takes 10 minutes.
But whether using Windows or Linux, you still have to have all setup correctly for the web pages to display.
There are tons of tutorials on properly setting up an Apache Virtual Host.
Hi All, I've been really stuck on this for a while now. After a lot of googling and asking those who are experts in the field I have found this solution to work:
create a file called .htaccess
within that file add the code below
please note that I am using XAMPP and within the htdocs folder I have a folder called lessons where all the code is stored for lesson 16
RewriteEngine On
RewriteBase /lessons/
RewriteRule ^.*$ index.php [END]
what this does is that it creates a rewrite module so that whenever you input in localhost/lessons/about it reroutes it to index.php. Index.php has a router that directs the code as to where to direct that additional URL to. Please notes that my routes file is a little different and is this code: