user.domainname.com and domainname.com/user

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
pyronguyen
Forum Newbie
Posts: 1
Joined: Mon Sep 22, 2003 3:04 pm

user.domainname.com and domainname.com/user

Post by pyronguyen »

am working on my community site ( got user list). And anybody can show me how to code as:
http://user.domainname.com or http://domainname.com/user

Example, nomarly like :
http://www.abc.com/member/user-detail.p ... pyronguyen
but i want to code to display as :
http://www.abc.com/member/pyronguyen
or http://pyronguyen.abc.com so far

or show me some tutorials, links about it. Thanks so much
Aaron
Forum Commoner
Posts: 82
Joined: Sun May 12, 2002 2:51 pm

Post by Aaron »

Ive tried this before and its extremely hard todo. Youll also need good contact with your host.

http://www.evolt.org/article/Making_cle ... /18/22880/ - enjoy.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

You can tidy up by sending GET vars as a "/" separated string, then explode the query string to get the individual values.

That leaves a "?" in there. Some people say that defeats search engines. My understanding is that this isn't much of an issue since the main SEs - including Google - don't have a problem.

There's a trick you can do with mod_rewrite to get rid of the "?" as well see
http://www.apache.org/
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

My understanding is that this isn't much of an issue since the main SEs - including Google - don't have a problem.
Unless I'm mistaken, that's not true. Google can't crawl a virtual URL (one loaded with GET variables) but it will happily crawl through a virtual directory structure. There's a chance I'm wrong about that, and Google CAN in fact handle variable URLs, in which case color me impressed.

Anyway, that evolt article is good on theory but outdated on practice. Using Apache's mod_rewrite is in fact the way to go.
[/quote]
Aaron
Forum Commoner
Posts: 82
Joined: Sun May 12, 2002 2:51 pm

Post by Aaron »

Make a htaccess with

Options +FollowSymlinks
RewriteEngine on
RewriteRule !\.(.*) index.php

in.
Post Reply