Web Design Forum: How to create vanity URL (url aliases) for different users - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to create vanity URL (url aliases) for different users URL Aliases Rate Topic: -----

#1 User is offline   rama14 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 23-March 09
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 23 March 2009 - 01:34 PM

Dear All,

I am Ram, i am new to hosting website. I have newly created a website, i have given a option to users to the set my website as homepage. I would like to display the users name at top of the mywebsite, when they open the web browser each time.

I have tried in many way, but is not done my me. If anyone knows, please help me on this.

And also i want learn, how to create vanity URL for users as given below

Normal URL: www.mywebsite.com

vanity urls: www.mywebsite.com/user1
www.mywebsite.com/user2

or

www.mywebsite.com/user id=1
www.mywebsite.com/user id=2


Please help me, if anyone know how to do it.
0

#2 User is offline   TomCash 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 192
  • Joined: 15-March 09
  • Reputation: 30
  • Gender:Male
  • Location:Wolverhampton, England
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 23 March 2009 - 02:26 PM

Most people use mod_rewrite. It's a function/module of Apache.

http://httpd.apache....od_rewrite.html

It's relatively basic if you follow the tutorials that are around. It works through htaccess if you have permission to edit this file.

It points page URL's like this:

http://www.whotoseel...com/artist/pulp

to page URL's like this:

http://www.whotoseel...dex.php?id=pulp

Without the user ever knowing.

It's great SEO and most top sites uses it these days.

Finally, I noticed you asked about URL's like this:

www.mywebsite.com/user id=2

Those are performed with GET statements. Relatively simple programming to pick up as there's an inordinate amount of resources dotted around the web on how to do it.
0

#3 User is offline   skidz 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,047
  • Joined: 24-November 08
  • Reputation: 135
  • Gender:Male
  • Location:Derby
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 25 March 2009 - 09:24 AM

I'm not too up on mod_rewrite but there are a fair few generators about (Google: mod_rewrite generator). I'm not sure how good they are as I use the same .htaccess accross all my sites (took me a while to figure out and now I've forgot.... Try: http://www.webmaster-toolkit.com/mod_rewri...generator.shtml

For linking like: http://url.com/index.php?user=1 use the following code

// Page URL for example is: http://url.com/index.php?user=1

$id = $_GET['user'];

//should sanitise this properly but for the purposes of demonstration Ill just force int it (if the value is not an integer it will become 0);

$id = (int)$id;

//not you have the user id (1 in this example) stored is $id

echo $id;

0

#4 User is offline   rama14 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 23-March 09
  • Reputation: 0
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 25 March 2009 - 12:55 PM

Dear Mr.skidz / Mr.TomCash,

Thanks for your help.

But i can't understand mod_rewrite method, can you please explain step by step, it would be more helpful.
0

#5 User is offline   skidz 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,047
  • Joined: 24-November 08
  • Reputation: 135
  • Gender:Male
  • Location:Derby
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 25 March 2009 - 01:04 PM

This URL contains query string parameters that encode blog entry dates

http://www.example.com/Blogs/Posts.php?Yea...h=12&Day=10

but can be altered to give the user a clear idea of what he or she is going to see

http://www.example.c...ogs/2006/12/10/

The second address also allows the user to change the URL to see all postings available in December, simply by removing the text encoding the day '10', and thereby saving having to navigate the GUI.

http://www.example.com/Blogs/2006/12/

Another example might be changing

http://example.com/w...itle=Page_title

to

http://example.com/Page_title
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users