I have done the following as described as follows: In index.php, we replace else if ($route === ‘joke/home’) { with else if ($route === ‘’) {. If we refresh the home page, it should display as expected.
However when I click on my HOME link( <a href=“/”>Home</a>), the following is the URL is returned: http://localhost/index.php?route=index.php
This is in my htaccess:
RewriteRule ^.*$ /index.php [NC,L,QSA]
Am new to REGEX and took this from Pg375. This I believe loads index.php if the requested location is not found.
How then does one create a HOME link of ‘/’ while still having the REGEX in place to default a not found address to /index.php?
What do you mean by “The URL is returned”? If you are seeing that in the address bar it means that index.php is triggering the rewriterule, make sure you have the two RewriteCond directives in your .htaccess file.
I’m not sure where the URL http://localhost/index.php?route=index.php is coming from, there is nothing in the RewriteRule that adds the route URL variable. If you have set up a redirect previously it may be a cache issue, can you try visiting just http://localhost/ in a different browser?