Jump to content


URL moving?


5 replies to this topic

#1 1288

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 29 September 2006 - 06:28 PM

hay I just wanted to know how to websites like have there url more to say a members profile?

for example if a users url redecertor is www.sitename.com/pure and the users name is pure how do i make the main page pick this up and use it to move to the users profile page?

so like www.sitename.com takes you to index page like normal and www.sitename.com/pure takes you this users profile page.

#2 GCORE

    Young Padawan

  • Members
  • Pip
  • 23 posts
  • Location:Colchester, Essex, United Kingdom
  • Interests:Website Development/Design<br />Graphic Design<br />Street Art<br />Live Concerts<br />Musican Promotion

Posted 29 September 2006 - 07:11 PM

I'm pretty much less than a "newbie" to PHP, but could somebody achieve this by using the GET function to get the username, then grab everything else on the profile by refereing the database results to the username?

This is a question I've often pondered about myself, it would be cool to see how wrong (most likley) or right I am about this.

Btw, you mean like, the way www.deviantart.com works?
E.G http://username.deviantart.com is the page and username is the well... username ?

- Adam

#3 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 29 September 2006 - 10:02 PM

Yup. :unsure:
The script gets the username by the GET method ($_GET['user']), then a mod_rewrite forms this easily.

RewriteRule $(.*)/$ /member.php?user=$1 [nc]
Basically just like that. ;)

#4 GCORE

    Young Padawan

  • Members
  • Pip
  • 23 posts
  • Location:Colchester, Essex, United Kingdom
  • Interests:Website Development/Design<br />Graphic Design<br />Street Art<br />Live Concerts<br />Musican Promotion

Posted 30 September 2006 - 01:50 AM

Hell yeah!

I was right about something! :unsure:

Even if 1288 doesn't check back on this thread, thank you Demonslay ;).

- Adam

#5 1288

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 01 October 2006 - 08:32 PM

hay sorry i havnt replyed i have hat the net for a bit but ya i was looking at mabby getting it like www.deviantart.com but i just cant get my head around it. i can do things like ?id=1 but how can i do that exact thing but have it use the username like with deviantart.com or if i cant get that id like to atlease get the www.site.com/username

also sorry Demonslay i dont get exactly how that works

and also adam127 ill take a look at mod rewrite :D soz i just didnt know it was called that

#6 cheerio

    Young Padawan

  • Members
  • Pip
  • 246 posts
  • Gender:Male

Posted 01 October 2006 - 09:14 PM

Demonslay is showing you how you can use mod_rewrite to change your URL's. You can set mod_rewrite up in a .htaccess file ( that's where to put his code into ), but you can't just copy / paste you really need to learn some of the basics. Check out some of these links to get a grip on mod_rewrite.

1. http://www.sitepoint...e-url-rewriting
2. http://zulumonkey.org/?id=tutorials&pa...ment&oid=75





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users