Basically it is range problem in .htaccess file while rewring URL for redirecting
RewriteEngine on
RewriteCond %{REQUEST_URI} Delhi/(.*)/([45-600])
RewriteRule Delhi/(.*)/([45-600]) sd/pages/sub_category.php?city=Delhi&Id=$2
RewriteRule Delhi/(.*)/([45-600]) sd/pages/sub_category.php?city=Delhi&Id=$2
But it is not working as it is supposed to be
Actually i want to redirect page if there is any Id from 45 to 600. But is also redirecting ids like 4, 41,42.........49 and so on.
i also tried as bellow
RewriteCond %{REQUEST_URI} Delhi/(.*)/([(45)-(600)])
RewriteRule Delhi/(.*)/(([45)-(600)]) sd/pages/sub_category.php?city=Delhi&Id=$2
RewriteRule Delhi/(.*)/(([45)-(600)]) sd/pages/sub_category.php?city=Delhi&Id=$2
but it didn't work at all
please help asapRegards.....
Upendra Pratap ShahiPosted May 26, 2015, 8:50 AM
sachin JoshiPosted May 26, 2015, 8:33 AM
In URL Rewriting in .htaccess file Regular Expression is required.
To redirect URL between 40 to 900 :
Regular Expression will be like : (4[0-9] | [5-9][0-9] | [1-9][0-9][0-9] )
And URL will be like :
RewriteRule Dehradun/(.*)/(4[0-9]|[5-9][0-9]|[1-9][0-9][0-9])sd/pages/location.php?city=Dehradun&Id=120