sintax63 Posted January 17, 2010 Share Posted January 17, 2010 Hello forum - I have a RewriteRule that I have been using for a while which has served me well: RewriteRule ^([^\/]+)\/?$ main/?login=$1 This allows me to to take http://mydomain.com/main/index.php?login=username ... and rewrite it to the following: http://mydomain.com/username As I said, all has been well until I started coding up my calendar page which has an additional variable ($event) tacked on to the URL. This is the actual, unwritten URL structure http://mydomain.com/main/calendar/view.php?login=username&event=2 that I need to rewrite back to http://mydomain.com/username/calendar/view.php?event=2 I have currently come up with the following RewriteRule RewriteRule ^([^\/]+)\/calendar\/view.php([0-9]+)?$ main/calendar/view.php?login=$1&event=$2 which works fine for the login variable but it doesn't pass the event one. This will pull up the web page correctly, URL wise, but won't acknowledge the $event variable at all. I have read through several tutorials already trying to figure it out myself but have yet to get it working. Would anyone be able to show me what I'm doing wrong? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/188791-adding-second-variable-to-my-rewrite-string/ Share on other sites More sharing options...
sintax63 Posted January 17, 2010 Author Share Posted January 17, 2010 have continued to troubleshoot this all afternoon with no luck. Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/188791-adding-second-variable-to-my-rewrite-string/#findComment-996853 Share on other sites More sharing options...
sintax63 Posted January 18, 2010 Author Share Posted January 18, 2010 After much digging and reading, I came up with this solution... RewriteRule ^([^\/]+)\/calendar\/view.php?$ main/calendar/view.php?login=$1 [QSA] which basically added the [QSA] to the end of the rule. Not sure if its the best way, but it works for now! Quote Link to comment https://forums.phpfreaks.com/topic/188791-adding-second-variable-to-my-rewrite-string/#findComment-997261 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.