3
I’m having a hard time setting up some route rules in my .htaccess
, I originally have the following (I accept suggestions for improvements):
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Everything is loaded in my index, loading together all the functions of the system, including the header and the default footer, but I need to add two pages that will not consume of this header or footer. I thought doing as below would solve, but no.
Another point, this I think I forgot how to do is to differentiate folders from files.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
RewriteRule ^login/?$ /login.php [NC,L]
RewriteRule ^start/?$ /start.php [NC,L]
On my index, I have:
$modulo = Url::getURL(0);
if($modulo == null or $modulo == 'index.php'):
$modulo = "dashboard";
endif;
if(file_exists($modulo.".php")):
require $modulo.".php";
else:
require "404.php";
endif;
I will test on the project here. Thanks for your attention.
– Helison Santos
The second option worked perfectly, already first caused a loop and gave error 500.
– Helison Santos
I updated the post leaving only what works
– Paulo Marques