Page 1 of 1

.htaccess help

Posted: Tue Dec 08, 2009 8:09 pm
by dsick
i wan't to remove .php from this so my url will be http://localhost/member/dsick, as of now its http://localhost/member.php/dsick... that redirects to http://localhost/member.php?dashboard=dsick, also how would i just take out the member, because on a main profile page the url is just going to be http://localhost/dsick

RewriteEngine on
RewriteRule ^dashboard/([^/\.]+)/?$ member.php?dashboard=$1 [L]

Re: .htaccess help

Posted: Wed Dec 09, 2009 11:08 am
by dsick
ahhh big problem.. now all my urls that had ?query=query

in the url aren't functioning as $_GET

so everything im selecting from the database based on what $_get query is in the url is not working

localhost/members.php/dsick

needs to also forward to localhost/members.php?dashboard=dsick, the big url is being pointed to localhost/members.php/dsick.. i dont think i have a rule set up that points localhost/members.php/dsick to localhost/members.php?dashboard=dsick



heres an example .. this is the screenshot from the regular link http://localhost/community/member.php?dashboard=dsick


Image

you can probably already guess what happens when you go to the redirected url... everything that was coming from the database, based on the $_get query is lost..... so basically all the friends and everything else coming from the database will be deleted when i type in the short url

Re: .htaccess help

Posted: Wed Dec 09, 2009 11:17 am
by AbraCadaver
I don't really understand your problem. Maybe if you just list some URLs that you want and what they need to be rewritten to. Also, read on QSA for the rewrite rule.

Re: .htaccess help

Posted: Wed Dec 09, 2009 11:40 am
by dsick
i want the big url redirected to the short url... and the short url redirected to the big url.. so i don't lose any data that relys on the $_get query

big url
http://localhost/member.php?dashboard=dsick
short url
http://localhost/member.php/dsick


http://localhost/member.php/dsick
short url
http://localhost/member.php?dashboard=dsick
big url

also work with my rule..

RewriteEngine on
RewriteRule ^dashboard/([^/\.]+)/?$ member.php?dashboard=$1 [L]

just make changes to it

Re: .htaccess help

Posted: Wed Dec 09, 2009 11:55 am
by dsick
update... i figured it out.. after hours of debugging :o


this will redirect.. localhost/member.php?user=username

to localhost/username

if you use this code.. modify it, only thing you change is member.php and dashboard..

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ member.php?dashboard=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ member.php?dashboard=$1