neilfurry Posted December 10, 2008 Share Posted December 10, 2008 Can somebody help me with this: i have 2 URL's that needs to be rewritten using RewriteRule on my .htaccess, this are the two URL: http://mysite.com/index.php?page=commerce&college http://mysite.com/index.php?page=about can you help me write a RewriteCond for this URL's on a .htaccess. Regards. Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/ Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 http://corz.org/serv/tricks/htaccess2.php Exactly what do you want to do/how do you want to rewrite them? You need to give us more information on exactly what you want. Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711078 Share on other sites More sharing options...
neilfurry Posted December 10, 2008 Author Share Posted December 10, 2008 currently i have this : RewriteRule ^(.*)\.html$ index.php?college&page=$1 [NC], this works fine, that when i click on a link with mypage.html it will give the page of http://mysite.com/index.php?page=cas&college, but i need another condition for this URL: http://mysite.com/index.php?page=about i have used the following script but it doesn't work: RewriteRule ^(.*)\.html$ index.php?college&page=$1 [NC] RewriteRule ^(.*)\.html$ index.php?page=$1 [NC] Regards. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711084 Share on other sites More sharing options...
premiso Posted December 10, 2008 Share Posted December 10, 2008 Why not just check if page is equaled to about before you check if college isset? Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711086 Share on other sites More sharing options...
neilfurry Posted December 10, 2008 Author Share Posted December 10, 2008 This are different all i need is just a condition for this two RewriteRule ^(.*)\.html$ index.php?college&page=$1 [NC] RewriteRule ^(.*)\.html$ index.php?page=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711116 Share on other sites More sharing options...
neilfurry Posted December 10, 2008 Author Share Posted December 10, 2008 just to be clear this is the scenario: mypage.html goes with -----> RewriteRule ^(.*)\.html$ index.php?college&page=$1 [NC] which has the variable college in the URL then, mypage2.html ------> goes with RewriteRule ^(.*)\.html$ index.php?page=$1 [NC] which does not have the college variable in the URL i need just the RewriteCond for this, Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711119 Share on other sites More sharing options...
DarkerAngel Posted December 10, 2008 Share Posted December 10, 2008 Yes but the way you have it written any page that ends in ".html" will be matched and then directed through the first rule. Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711120 Share on other sites More sharing options...
teng84 Posted December 10, 2008 Share Posted December 10, 2008 This are different all i need is just a condition for this two RewriteRule ^(.*)\.html$ index.php?college&page=$1 [NC] RewriteRule ^(.*)\.html$ index.php?page=$1 [NC] that doesnt make sense i guess because it will match the first and the last condition so it will always be the first.. correct me if i was wrong any way.. pre explain mo nag maiigi tapos add mo ko sa YM teng84 pre i think you need to add specific rule on each condition Quote Link to comment https://forums.phpfreaks.com/topic/136299-url-rewrite-question/#findComment-711123 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.