JasonO Posted October 15, 2008 Share Posted October 15, 2008 Hi, My question is exactly like the question here: http://www.phpfreaks.com/forums/index.php/topic,220713.0.html Unfortunatly it is solved and I can't post in that topic. The thread author originally had a problem with what was given to him, but then he just said he fixed it without actually posting what he done. I don't know how, but for some reason it doesn't work for me either (get 404 page not found error). I've tried contacting the thread author about a solution but nothing yet. Basiclly I currently have this in my htaccess file RewriteEngine On RewriteRule ^([^/\.]+)?$ index.php?p=$1 [L] This allows me to have http://domain.com/home the same as having http://domain.com/?p=home However, I need to have more parameters in the URL which I want to have like http://domain.com/home/login for example. The hidden URL would then be along the lines of http://domain.com/?p=home&p2=login I've tried finding out what each symbol means and playing around but I just get 404 errors or server errors when I try them. Where am I going wrong? Thanks, Jason Link to comment https://forums.phpfreaks.com/topic/128556-solved-url-rewrite-with-2-parameters/ Share on other sites More sharing options...
JasonO Posted October 15, 2008 Author Share Posted October 15, 2008 OK, I've got it kinda working I believe. I can get the two parameters from a URL like http://domain.com/site/login and also 1 parameter if a second is not given from say http://domain.com/site/. However, If I miss the trailing slash on the end of the URL off (so like http://domain.com/site), I get a 404. How would I go about geting around that. This is what I have as my rule. RewriteRule ^([^/\.]+)?/([^/\.]+)?$ /index.php?p=$1&p2=$2 Thanks. Edit - Done it This is the Rewrite Rule I use to pass 2 parameters into a page RewriteRule ^([^/\.]+)/?([^/\.]+)?$ /index.php?p=$1&p2=$2 Will allow URL's like http://site.com/user/login » http://site.com/index.php?p=user&p2=login http://site.com/user » http://site.com/index.php?p=user http://site.com » http://site.com It will pass the parameters on so on the server. Thanks anyway guys! I hope this post helps others. Feel free to PM me if you get stuck, and have a problem exactly like this Regards, Jason Link to comment https://forums.phpfreaks.com/topic/128556-solved-url-rewrite-with-2-parameters/#findComment-666408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.