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.
Page 1 of 1
How to create vanity URL (url aliases) for different users URL Aliases
#2
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.
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.
#3
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
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;
#4
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.
Thanks for your help.
But i can't understand mod_rewrite method, can you please explain step by step, it would be more helpful.
#5
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
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
Share this topic:
Page 1 of 1
Help
















