.htaccess help

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
dsick
Forum Commoner
Posts: 57
Joined: Fri Mar 27, 2009 3:34 pm

.htaccess help

Post 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]
dsick
Forum Commoner
Posts: 57
Joined: Fri Mar 27, 2009 3:34 pm

Re: .htaccess help

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: .htaccess help

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
dsick
Forum Commoner
Posts: 57
Joined: Fri Mar 27, 2009 3:34 pm

Re: .htaccess help

Post 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
dsick
Forum Commoner
Posts: 57
Joined: Fri Mar 27, 2009 3:34 pm

Re: .htaccess help

Post 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
Post Reply