HTACCESS file not working for Clean URL

Folder where page.php resides: http://www.MySite.com/index/product-details/

URL: http://www.MySite.com/index/product-details/1276/Electric-Circuit-Breaker

item_id parameter: 1276

item Title: Electric-Circuit-Breaker

I just need page.php to read 1276 as item_id. This is my failed attempt at an htaccess file:

RewriteEngine on
RewriteRule ^([a-zA-Z0-9]+)$ page.php?item_id=$1
RewriteRule ^([a-zA-Z0-9]+)/$ page.php?item_id=$1

Please tell me where I'm going wrong. Htaccess file is in product-details/ folder

Answers


Given the .htaccess file in question is on the folder /root/index/product-details/ aka http://www.MySite.com/index/product-details/:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /index/product-details/

RewriteRule ^index/product-details/([0-9]+)/(.*)$ page.php?item_id=$1 [NC,L]

It will capture the id only and internally redirect.

If the above doesn't work change the rule into:

RewriteRule ^([0-9]+)/(.*)$ page.php?item_id=$1 [NC,L]

Need Your Help

How to count how many bars back the moving average crossed last?

mql4 metatrader4

I am writing an MQL4 Custom Indicator that would tell how many bars ago a particular set of moving averages crossed.

Quotations above ssi file

apache include ssi

I have installed Apache 2.2 on windows. I have turned on Includes and my shtml files include their respective html files.