View Full Version : User url
g354u2nv
11-26-2005, 05:14 AM
How can I change the user url
from www.whatever.com/user/?P= to www.whatever.com/username?
Thanks in advance!
Sinfullilblonde
11-26-2005, 06:00 AM
If your running your phpfox on a apache server, which i feel most are :D
you can use the .htaccess RewriteRule to create that mod for you.
Best you shut down the site before you do this, cause if your new to apache and mod rewrite rules you might come accross some errors.
This mod is great for phpfox but also for alot of other scripts. Adding fake urls make it look a whole lot better to.
1. First what you want to do is create a file called .htaccess in your root directory.
2. Open that up and add this:
Content visible to registered users only.
Now if you look at the code above ive added in: RewriteCond %{REQUEST_URI} !^.*/admin/
This is there to tell apache no to go to those folders, so you will have to add in the rest of the folders you have like: RewriteCond %{REQUEST_URI} !^.*/gallery/
Be sure to add all the folders
3. Create a folder called "module" in your root directory
Now in that folder we have to add a php file named after each folder you have in the root directory. So now if you have a folder called "fun" you then created a php file called "fun.php" and place the in the "module" folder.
Open the fun.php and add:
Content visible to registered users only.
This whole "module" folder is only to help out, cause alot of the links in the phpfox source do not have a trailing slash. There are some links that end up like this http://www.somesite.com/forum. Which without the RewriteRule will go to
http://www.somesite.com/forum/ but now since your going to have the RewriteRule it wont go there and your users will have no forum. So thats what we use the "module" folder to send and links without a trailing slash to the proper location. Be sure to create all the php files with the same names as the folders in the root dir.
4. Open up index.php in your root directory and put this:
Content visible to registered users only.
So now the index.php will read the page if the user is a member of the site.
5. Next we have to open up "/user/index.php"
and look for this:
Content visible to registered users only.
and replace that with this:
Content visible to registered users only.
That will now send the user to www.whatever.com/username
I think i covered everything needed for the mod. :)
Try it out and leave your feedback if this helped or if you guys have a better way of doing this. :D
g354u2nv
11-26-2005, 07:24 PM
I appreciate the help!! Im having a couple of problems though. I did everything as you said, however my homepage has disappeared its no just menu links top and bottom. When you click on a member it takes you back to the homepage that didnt originally exist. Im sure I have some links crossed somewhere, can you please help? =)
Sinfullilblonde
11-26-2005, 07:31 PM
Content visible to registered users only.
no no, its my bad i left something out in the index.php source.
Can you try to add that source i added above for the index.php and it should work. :D
g354u2nv
11-26-2005, 07:37 PM
Ok nevermind that problem, fixed that issue. (My stupidity) However now I have 1 more problem. I had fixed my profile pages to have the same top menu as te rest of the homepages. Now when visitng a profile, the main profile page has no top menu, however the rest do. Any ideas?
Sinfullilblonde
11-26-2005, 07:48 PM
hhmm ok, yeah i think if you open up "/inc/template/profile_template.php" that is where you added the code right to include the main_top.php which displays the top menu?
If so i think it should be something like this:
Content visible to registered users only.
to call the main_top.php to the script.
g354u2nv
11-26-2005, 08:05 PM
yea, just a basic include.
Sinfullilblonde
11-26-2005, 08:23 PM
if possible can you share your "profile_template.php" on here.
cause i think the above include call should work fine. Cause if you dont see a top menu then it cant seem to find the correct php file.
g354u2nv
11-26-2005, 08:28 PM
Im a jackass. I just got it. Anyhow, this worked exactly how you said. Looks great! Thanks for all your help!
g354u2nv
11-26-2005, 08:53 PM
Ok after playing around I noticed on the main page the Who's Online and Websearch tabs route you back to the home page. Youve been the man so far, any ideas?? =)
You have to create another php file in the root directory.
You can create a fill called "default.php" which is what i used. Its not a big deal what you call the file and add this:
Content visible to registered users only.
This will play as the index file.
Next you will have to open up "/inc/html/html_home.php"
and look for links like
Content visible to registered users only.
and change that to:
Content visible to registered users only.
I think there are about 10 links that link back to the index file so you will have to simply add default.php or whatever you call the php file :D
You can also add another thingy to the signup page to make sure your members
dont signup with the name gallery and then your gallery section wont work. :(
Open up "/signup/index.php" and look for:
Content visible to registered users only.
and right above that add:
Content visible to registered users only.
Hope this Helped
Piggedy
12-24-2005, 05:51 PM
Hello,
I have successfully change the user name from www.whatever.com/user/?P= to www.whatever.com/username? but now when a new user signs up it tells them their "MY PROFILE URL: http://whatever.com/user/?P=Johnsmith when the true URL is http://whatever.com/Johnsmith
How can I make it automatically give the user the correct URL when they sign up. Thank you in advance!
~Piggedy
natio :: phpFox
12-25-2005, 02:42 AM
Content visible to registered users only.
Hey,
Great! you got this to work. Yeah if you want to change the actual URL it wont worked auto. you will have to open up the actual source and change it up yourself. So if you want to change it open up /member/html/html_member.php and then look for this:
Content visible to registered users only.
and replace that with this:
Content visible to registered users only.
so now it should show: http://whatever.com/Johnsmith
Is that what you want to change? :)
kitamura
12-30-2005, 10:17 AM
Content visible to registered users only.
That previous solution doesn't seem to apply to 1.04...
Here's my super-simple solution:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/[^/\.]+$
RewriteRule ^(.*) /user/?P=$1
It's relies on not having a trailing slash after the username. Any other link to another part of the site *should* have a trailing slash (like /gallery/ or /blog/)
Let me know if this helps anyone...
Masao
clasione
04-05-2007, 05:04 PM
I have had to delete two users today because of the mod rewrite...
the usernames began with:
fun
and
music
and because of the rewrite, their profiles were redirecting to the music and fun sections.... Has this happened to anyone else?
vBulletin® v3.6.10, Copyright ©2000-2009, Jelsoft Enterprises Ltd.