Currently my .htaccess code sends the {REQUEST_URI}
as a $_GET
array to load.php
where that page calls up the controllers for the request. For SEO purposes, I would like to remove a portion of the URL without changing the $_GET
array that is sent to load.php
.
For example if I have:
domain.com/products/product-name
I would like the URL to display:
domain.com/product-name
without changing the $_GET
variable that is sent to load.php
.
Any help would be greatly appreciated. I've included my current code.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
CLARIFICATION:
$_GET[0]
serves as a 'controller' variable which directs the application to open up the appropriate file. Therefore, I can't hardcode 'products' into $_GET[0]
because that would constantly open up controllers/products.php
instead of the appropriate file.