Eventhough I'm new at htaccess, I've been learning a lot in the past few days, but I'm stuck on a certain part that resulted in the website not behaving as desired. Here is the part of the code where I have my delima:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f
Rewriterule ^ %{REQUEST_FILENAME}.php [NC]
# RewriteCond /templates/%{REQUEST_FILENAME}.html -f
RewriteRule ^([^/\.]+)$ index.php?$1 [NC,S=1]
RewriteRule ^([a-zA-Z0-9]+)$ product.php?product_id=$1 [NC]
The first RewriteCond and RewriteRule works perfect. My problem with what goes afterwards.
What I need to achieve is that when a user inputs /some-word it would search if a file with the same name is valid in the /templates folder, and hence would serve it as index.php?some-word, else it would be served as product.php?product_id=some-word. The the index.php rule works well when the second condition is commented out, but when added only the product.php rule works.
The supplied "tag" could be numbers, letters, hyphenated words (i.e. any-words), or a combination of numbers and letters. The rules should be case insensitive.
I appreciate any assistance on the matter.