Jump to content

Recommended Posts

I am starting a site where users will be able create pages and the pages will need to be displayed when the URL reads

 

www.mysite.com/NewUser.

 

The pages are database driven and are created based on User IDs

 

I have not done this before and I'm looking for the best method to achieve this goal.

 

Similar to myspace.com/User or Blackplanet.com/User

 

thanx

Link to comment
https://forums.phpfreaks.com/topic/145169-solved-wwwmysitecomnewuser/
Share on other sites

just a note, doing it your way you would have to take the username, (unless they enter the id?) check your database to find the userid, and then run the rest of the page off that,

 

for this sort of thing i would suggest that you base your queries off there username. (assuming each username is unique)

but anyway the basic logic you need is

 

Options +FollowSymlinks

RewriteEngine on

RewriteRule ^([0-9a-z_]+)$ index.php?username=$1 [NC]

 

which basically when a user types in eg mysite.com/john_doe

 

the server will load mysite.com/index.php?username=john_doe

Thanks and that work GREAT!!

 

- BUT -

 

Now i need to know how to get the rest of the variables to register...

 

http://www.e2minutesites.com/name will bring up the for the 'ID' that correlates with 'name'

 

but how do i get my links in the page to work correctly.

 

Site: http://www.e2minutesites.com/casana

 

i want my links to still use show the 'name' in the URL like above - but there are variables that follow to get different pages

 

http://www.e2minutesites.com/casana?additional_page=page_id    - HELP!

 

thnx again!

Got it all together:

 

Options +FollowSymLinks

 

RewriteEngine On

RewriteBase /

RewriteRule ^([0-9a-z_]+)/([0-9a-z_]+)$ members.php?url=$1&id=$2 [NC]

RewriteRule ^([0-9a-z_]+)/([0-9a-z_]+)/$ members.php?url=$1&id=$2 [NC]

RewriteRule ^([0-9a-z_]+)$ members.php?url=$1 [NC]

RewriteRule ^([0-9a-z_]+)/$ members.php?url=$1 [NC]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.