Skip to Content Skip to Menu

Short profile URL mysite.com/username

  • bickf23
  • bickf23
  • OFFLINE
  • Posts: 6
  • Thanks: 0
  • Karma: 1
12 years 8 months ago #193186 by bickf23
Short profile URL mysite.com/username was created by bickf23
Hello.

I've been trying to do this for a long time but it looks like I don't have enough programming experiance to do this.

I'm trying to make it possible for users to link to their profile using www.mysite.com/username instead of mysite.com/component/comprofiler/userprofile/username

I found 2 methods that might be able to do this, but it seems they both need a little tweeking.

#1 the 404 way:
by adding an error.php containing this code to the directory of my template.
Apparently one should change the mandatory menu item name for CB profiles to match the string in the error.php. In this case it's "blogger"
Code:
<?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); if (($this->error->code) == '404') { $profile=str_replace("/", "", $_SERVER['REQUEST_URI']); header("Location:blogger/userprofile/".$profile.""«»); exit; } ?>

However when I try to access a profile like mysite.com/username or any other page that would normaly give me a 404 error, I simply get a blank page instead of being redirected to the profile.



#2 the .htaccess way.

This actually allows users to access their profile by using mysite.com/username.
The problem here is that it makes joomla think that all pages are profiles, therefore giving me the message "This profile does not exist or is no longer available" on almost every page that is not a profile. It also blocks some of my components making that page blank except for the main menu.
Code:
## # @version $Id: htaccess.txt 1005 2006-10-05 18:00:00Z stingrey $ # @package Joomla # @copyright Copyright (C) 2006 Open Source Matters. All rights reserved. # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL # Joomla! is Free Software ## Options +FollowSymLinks # # mod_rewrite in use # RewriteEngine On # Uncomment following line if your webserver's URL # is not directly related to physical file paths. # Update YourJoomlaDirectory (just / for root) RewriteBase / # # Rules # # # ProfileRedirector V 1.3 # # Make sure your host allows option override # and has ModRewrite installed # activate Rewrite enginge RewriteEngine On RewriteBase / RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/?$ /index.php?option=com_comprofiler&task=userProfile&user='$1' [L] # RewriteRule ^(.*) index.php?cb_username=$1 RewriteCond %{REQUEST_FILENAME} !.(jpg|jpeg|gif|png|css|js|pl|txt)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.php


I find it ard to believe that there is no simpler option in CB to get this done, as this is a very vital function for community based sites. (noone wants to type component/comprofiler/userprofile/ in order to access their profile)

Any help on this would be great.
I see many people have been struggling with this before and I have already wasted way too much time trying to get this done.

Best wishes.

Please Log in or Create an account to join the conversation.

  • bk6366
  • bk6366
  • OFFLINE
  • Posts: 97
  • Thanks: 22
  • Karma: 4
12 years 8 months ago - 12 years 8 months ago #193296 by bk6366
Replied by bk6366 on topic Re: Short profile URL mysite.com/username
fwiw, I haven't used this commercial JoomSEF component but it may be something to look at.

Community Builder JoomSEF 4 Extension

This Joomla SEO extension for ARTIO JoomSEF enables generation of Search Engine Friendly (SEF) URLs for the Community Builder component for Joomla.


bk
---
J1.7.3 / CB 1.7.1 / PHP 5.2.17 (no, not upgrading yet)
Current J/CB Project

'Terse'
Guide to getting answers
Please note that pm's related to CB issues will go unanswered. That's what the forums are for.
Last edit: 12 years 8 months ago by bk6366.

Please Log in or Create an account to join the conversation.

  • kenb101
  • kenb101
  • OFFLINE
  • Posts: 21
  • Thanks: 0
  • Karma: 0
11 years 6 months ago #225749 by kenb101
Replied by kenb101 on topic Short profile URL mysite.com/username
Hello bickf23,
Any luck yet?
I have been trying to find a solution for months and still no luck. I tried purchasing SH404 and had nothing but trouble with it. I am only concerned with removing or shortening the "userprofile" part of the profile url. Does anyone know the location of the userprofile file or can anyone create a rewrite, such as up=userprofile (something to shorten its length or remove it all together).

I would gladly pay someone that could solve this problem.
KB

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum