By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 664 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

How to redirect url just like in blogger.com

P: 12
Hello Friends,

I want to create a blog for the user that register to my site(for example www.test.com) after that I want to redirect user to www.user.test.com.

That is just like in blogger.com. How can I perform this task is I did to create a subdomain for every user that register my site or just to create a page and redirect it www.user.test.com thorug .htacces.

please if anybody can guide me to perform this task.


Thanks.
Dec 6 '07 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
I think blogger may create subdomains for it; but then again they might just use htaccess

What im working on currently, is just something you're speaking of; something like myspace. ie. myspace/username

at first i thought the /username was an index page so like: /username/index.php, etc.

But turns out they use htaccess (more than likely)

You can do this by doing:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2. RewriteRule ^member/([A-Za-z0-9_-]+)$ member/?user=$1 [L]
  3.  
Using that code, when the user types in their profile page (yoursite.com/member/user-name-page) the appearance of the URL will remain as is, but the qualities will change.

The url yoursite.com/member/user-name-page will, in effect, be changed to yoursite.com/member/?user=user-name-page

Therefore, you could then use $_GET['user'] to retrieve the username and query your database for it!

The user will never see member/?user=
just /member/user-name-page

:)
Dec 6 '07 #2

Markus
Expert 5K+
P: 6,050
ooooops, double posted that by accident!
Dec 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.