arbitter Posted December 19, 2010 Share Posted December 19, 2010 So I heard of mod_rewrite a few days ago, and would love to implement it on my site. I can rewrite some basic ones, but I'd like to keep it simple and I don't know how.. My whole page consists of an index.php page Then there's the basic ones: index.php?fx=activities index.php?fx=somethingelse Those I have managed to rewrite to mydomain.com/activities using: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?fx=$1 [NC,L] The tricky part is where I have multiple $_GET[]'s for example: index.php?fx=photos&album=whatever and: index.php?fx=contact&info=whatever How do I manage this? Is it possible? I know I could use RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?fx=$1&album=$2 [NC,L] But that would make it work only for the photos, and actually it doesn't even do that... Is it possible to change this with mod_rewrite, or should I change the general layout of my $_GET[]'s with more universal ones? Quote Link to comment https://forums.phpfreaks.com/topic/222136-mod_rewrite-trouble/ Share on other sites More sharing options...
strago Posted January 22, 2011 Share Posted January 22, 2011 It needs to know if you want the album or info page. They can't both have the same kind of URL. Adding a fake directory will fix it. Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^fx/([^.]+)/album/([^.]+)$ index.php?fx=$1&album=$2 [NC,L] RewriteRule ^fx/([^.]+)/info/([^.]+)$ index.php?fx=$1&info=$2 [NC,L] RewriteRule ^([^.]+)$ index.php?fx=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/222136-mod_rewrite-trouble/#findComment-1163460 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.