mkohan Posted August 25, 2008 Share Posted August 25, 2008 Hi, Is it posssible to write a rule on .htaccess file with RewriteRule, RewriteCond and query_string that redirects this URL http://mydomain.com/&tip=variables&m=data.php to: http://mydomain.com/data.php&tip=variables Thanks, MK Quote Link to comment https://forums.phpfreaks.com/topic/121282-solved-is-it-possible-to-write-a-rule-with-rewritecond-and-query_string/ Share on other sites More sharing options...
corbin Posted August 25, 2008 Share Posted August 25, 2008 RewriteEngine On RewriteRule ^/&tip=([^&]+)&m=(.*?)\.php /$2.php?tip=$1 Should do it. (I rarely get rewrites correct on the first try, so it could be wrong.) Quote Link to comment https://forums.phpfreaks.com/topic/121282-solved-is-it-possible-to-write-a-rule-with-rewritecond-and-query_string/#findComment-625486 Share on other sites More sharing options...
mkohan Posted August 26, 2008 Author Share Posted August 26, 2008 Thank you for your response. after adding RewriteRule the Apache redirects the url to: http://mydomain.com/data.php without the last part &tip=variables . The last part ?tip=$1 does not work properly. Thanks, MK Quote Link to comment https://forums.phpfreaks.com/topic/121282-solved-is-it-possible-to-write-a-rule-with-rewritecond-and-query_string/#findComment-626101 Share on other sites More sharing options...
corbin Posted August 27, 2008 Share Posted August 27, 2008 Ahhh my bad. Try RewriteEngine On RewriteRule ^&tip=([^&]+)&m=(.*?)\.php /$2.php?tip=$1 Quote Link to comment https://forums.phpfreaks.com/topic/121282-solved-is-it-possible-to-write-a-rule-with-rewritecond-and-query_string/#findComment-626607 Share on other sites More sharing options...
mkohan Posted August 27, 2008 Author Share Posted August 27, 2008 Thanks. Mk Quote Link to comment https://forums.phpfreaks.com/topic/121282-solved-is-it-possible-to-write-a-rule-with-rewritecond-and-query_string/#findComment-627034 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.