PHP $_GET .htaccess rewrite -
htaccess:
rewriteengine on rewriterule ^test/ test.php rewriterule ^test/success/ test.php?success test.php:
<?php if(isset($_get['success'])) echo "success"; else { echo "nothing set"; } ?> when try access test.php /test.php?success works , echos "success". want work same way overwritten in htaccess. want echo message when open /test/success/. if possible, correct?
.htaccess rewrite rules read top bottom,
if apply input string, get
- start
/test/success/ - matches
rewriterule ^test/ test.phpbecomestest.php test.phpdoesn't matchrewriterule ^test/success/ test.php?success
we end test.php.
however, isn't want, because want last url rewrites test.php?success instead of other file. there easy fix problem, simple swap 2 lines of rewrite rules longer 1 listed first
resulting .htaccess file:
rewriteengine on rewriterule ^test/success/ test.php?success rewriterule ^test/ test.php
Comments
Post a Comment