Redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Redirect

Post by bigdavemmu »

Hello!

I have a small problem. MYSPACE is a good example of what I'm looking for. When I type in http://www.myspace.com/username I get redirected to the users profile page. I'm looking for the same result as this on my website.

Same as MYSPACE, I want the browser to be redirected to a page that shows the requested users profile but still has the correct URL in the address bar and not the URL of the actual page! I do not want to create a directory on the server for each user and then copy a profile page into each folder as this can become silly!

How do I do this?? I have no idea which is why I'm here. (Also, searching for anything to do with myspace and code brings up soooooo many irrelevant entries in search engines!)

Hope you guys and gals can help me!

**A distressed Irish Man!**

David! :>|
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

PM'ing people for help is rather rude - we look at everything eventually.

Anyway, read this: http://truehacker.blogspot.com/2006/11/ ... p-and.html
And don't do it again :x
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

Sorry mate. I've been trying to sort this out for weeks and deadline is a couple of days away so I need to get it done ASAP.

I know it's not your problem, but please bare with me! Cheers.

Taken a look at the link you gave me. It's cool but what if I can't access the config file for Apache? Is there another way of doing this?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Not to my knowledge, no.
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

By the way...

Let's say that you join my website with a username called "mod". To reach your profile page a random member of the public would type:

http://www.myurl.com/mod

Then the page would be served. However, there is not "mod" folder or page/file anywhere on the server. So I need to grab the "mod" from the URL requested and then use that in a page to serve the right profile page for the user. However, I also want to keep the http://www.myurl.com/mod in the address bar. So I don'#t want to move pages or I need a way to mask the URL.

I hope this clarifies a bit more!

Thanks

David
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

Problem solved. I used an .htaccess file to do apache mod_rewrite

Nice! Cheers anyway!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

bigdavemmu wrote:Problem solved. I used an .htaccess file to do apache mod_rewrite

Nice! Cheers anyway!
Uhh... isn't that the solution Grim suggested? :roll:
Post Reply