isedeasy Posted November 7, 2011 Share Posted November 7, 2011 I want to have urls that look like the following:- url - www.domain.com/login/ file - /sections/login.php url - www.domain.com/contact/ file - /sections/contact.php my index file just looks for the page name in the query string and includes the appropriate file. I have the following rule that sort of works but I need something that wont lose the rest of the query string. RewriteRule ^([a-zA-Z\_]+)[/]*$ index.php?pl=$1 I need it so that www.domain.com/home/?foo=bar will send my index.php the following vars $_GET['pl']; $_GET['foo']; foo could be anything and the amount of variables that can be passed back needs to be unlimited. Any help would be much appreciated. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/250645-files-to-folders-whilst-keeping-query-string/ Share on other sites More sharing options...
requinix Posted November 7, 2011 Share Posted November 7, 2011 Add a [QSA] flag to the RewriteRule. RewriteRule ^([a-zA-Z\_]+)[/]*$ index.php?pl=$1 [QSA] Quote Link to comment https://forums.phpfreaks.com/topic/250645-files-to-folders-whilst-keeping-query-string/#findComment-1286007 Share on other sites More sharing options...
isedeasy Posted November 7, 2011 Author Share Posted November 7, 2011 Thank you sir, that is exactly what I was looking for! Quote Link to comment https://forums.phpfreaks.com/topic/250645-files-to-folders-whilst-keeping-query-string/#findComment-1286009 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.