I have the following code:
RewriteEngine On
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^category/(.*)$ searchPage.php?crs_category=$1 [NC,QSA]
RewriteRule ^ index.php [QSA,L]
Now the way Slim Framework works is that all requests are redirected to index.php
, where index.php
route the requested path to its render page.
Hence, typing category/business
will not rewrite the url of searchPage.php?crs_category=business
but instead redirect to index.php
where Slim Framework will throw a page not found since there is no path category/:name
defined to be routed.
My problem is working out this scenario, where I would like all requests except category/NAME
to be redirect to index.php
.
I would also appreciate when someone types searchPage.php?crs_category=business
for that url to be rewritten to category/business with ideally a 301 status code.