PHP .htaccess issue, specific/dynamic keywords
- by Kunal
Here goes my .htaccess file's content.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^online-products$ products.php?type=online
RewriteRule ^land-products$ products.php?type=land
RewriteRule ^payment-methods$ payment-methods.php
RewriteRule ^withdrawal-methods$ withdrawal-methods.php
RewriteRule ^deposit-methods$ deposit-methods.php
RewriteRule ^product-bonuses$ product-bonuses.php
RewriteRule ^law-and-regulations$ law-and-regulations.php
RewriteRule ^product-news$ product-news.php
RewriteRule ^product-games$ product-games.php
RewriteRule ^no-products$ no-products.php
RewriteRule ^page-not-found$ notfound.php
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^casinos/(.*)$ product.php?id=$1
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ cms.php?link=$1
ErrorDocument 404 /notfound.php
What I am trying to achive here is that the first set of rules apply to some specific keywords which should redirect to specific hard coded pages. But anything else parat from those keywords should redirect to cms.php as a parameter as you can see.
But the problem is that every keyword is getting redirected to cms.php. Whereas I want any other keyword apart from which are already hard coded in .htaccess file should go cms.php. Not just every keyword.
Example:
www.sitename.com/online-products -> www.sitename.com/products.php?type=online
www.sitename.com/about-the-website -> www.sitename.com/cms.php?id=about-the-website
www.sitename.com/product-news -> www.sitename.com/product-news.php
Also another issue I am facing is I can not use any keyword with space. Like "online-products" is fine, but I can't use "online products".
Please help me out with your expert knowledge. Many thanks in advance for your kind help. Appreciate it.