php - .htaccess rule to restrict the url rewritting for unlimited parameters doesnot work -
i using .htaccess file rewritting url's in php based project. have written rules rewrite url accordingly. facing problem while writting url log-in.php 4 different cases. current rules follows:
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #home pages rule# rewriterule ^home index.php [l] rewriterule ^contact-support contact-support.php [l] #login rule# rewriterule ^login log-in.php [l] rewriterule ^login/([0-9]+)$ log-in.php?temporarybookingid=$1 [l] rewriterule ^login/([0-9]+)/([0-9]+)$ log-in.php?temporarybookingid=$1&jsessionid=$2 [l] rewriterule ^login/([0-9]+)/([0-9]+)/([a-za-z]+)$ log-in.php?temporarybookingid=$1&jsessionid=$2&name=$3 [l]
for current rules cases 1. when there no parameter in url should open login page default. 2. when there parameters, login page after filling login credentiials should redirect accordingly. 3. when parameter in url exceeds required limit must show page 404 page not found
the bottleneck coming here have written rule allow parametric urls 2 i.e. temporarybookingid & jsessionid & name. url work like
http://domain.com/login/1234/1234/sagar
but when add more parameters here like
http://domain.com/login/1234/1234/sagar/1234/1234
it should show me 404 not found error page
opening same page again. here if comment rule rewriterule ^login log-in.php [l]
above condition works & shows me error page if open simple login page navigates me 404 not found error page. how rule log-in.php page written in order satisfy conditions???
Comments
Post a Comment