I have this htaccess rule to redirect my page to data_parser.php
RewriteEngine On
RewriteRule ^main/([^/]+)$ data_parser.php?rand_code=$1 [nc]
when i print the request in data_parser.php the rand_code value turns out to be the filename of the page. For example url: http://mysite.com/main/ran12345. When print_r, this is the value i would see
[rand_code] => data_parser.php
instead of,
[rand_code] => ran12345
It’s getting the filename, what am i doing wrong with my rule?
Maybe try adding this in front of your
RewriteRule:Because what looks like is happening is the request is looping through your rules more than once. The second time, the
([^/]+)matches against data_parser.php.