Warriorpt Posted June 8, 2008 Share Posted June 8, 2008 Hi everyone, i have in my htacess this: #Rewrite Rules RewriteRule ^match/([0-9]+)$ ?k=match&id=$1 RewriteRule ^([a-zA-Z0-9]+)/$ ?k=about RewriteRule ^([a-zA-Z0-9]+)$ ?k=about RewriteRule ^([a-zA-Z0-9]+)/$ ?k=matches RewriteRule ^([a-zA-Z0-9]+)$ ?k=matches but, in my website, when i try to call /matches/ the website open the /about/ page. If i change to: #Rewrite Rules RewriteRule ^match/([0-9]+)$ ?k=match&id=$1 RewriteRule ^([a-zA-Z0-9]+)/$ ?k=matches RewriteRule ^([a-zA-Z0-9]+)$ ?k=matches RewriteRule ^([a-zA-Z0-9]+)/$ ?k=about RewriteRule ^([a-zA-Z0-9]+)$ ?k=about The /matches/ page open, but when i click in /about/, it opens the matches page. There are some way to repair that? Link to comment https://forums.phpfreaks.com/topic/109304-solved-help-with-rule/ Share on other sites More sharing options...
jamieburchell Posted June 9, 2008 Share Posted June 9, 2008 Hi there In your first example, if you access "/matches/" the second rule is redirecting you to your about page. This is because ^([a-zA-Z0-9]+)/$ is trying to find any combination of letters and numbers and a slash, which includes the string "/matches/". If you want something else to happen when you access "/matches/", create rules like this: RewriteRule ^matches/?$ ?k=matches RewriteRule ^about/?$ ?k=about The question mark is useful before the slash as it means with or without the preceding character. Hope this helps. Jamie Link to comment https://forums.phpfreaks.com/topic/109304-solved-help-with-rule/#findComment-560997 Share on other sites More sharing options...
Warriorpt Posted June 9, 2008 Author Share Posted June 9, 2008 Thank you very much jamieburchell, it works Link to comment https://forums.phpfreaks.com/topic/109304-solved-help-with-rule/#findComment-561000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.