binumathew Posted January 23, 2010 Share Posted January 23, 2010 I have a rewrite rule in my .htaccess file RewriteRule ^(\w+)$ user.php?id=$1 RewriteRule ^search$ /search/ The Above code is not working properly mydomain.com/username should redirect to user.php?id=username this work wonderfull What i need is mydomain.com/search should redirect to search.php how can it possible? Quote Link to comment https://forums.phpfreaks.com/topic/189560-rewriterrule/ Share on other sites More sharing options...
Adam Posted January 27, 2010 Share Posted January 27, 2010 Try removing the leading slash in "/search/". Quote Link to comment https://forums.phpfreaks.com/topic/189560-rewriterrule/#findComment-1002503 Share on other sites More sharing options...
cags Posted January 30, 2010 Share Posted January 30, 2010 The problem is the order of your rules. http://mydomain.com/search is hitting the first pattern and being sent to the user.php page. Move the second rule above the first rule. That way search will be redirected first. Quote Link to comment https://forums.phpfreaks.com/topic/189560-rewriterrule/#findComment-1004189 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.