Remove subfolder just for member profiles?

Discussions and support about the different URL Rewriting techniques for phpBB.

Moderator: Moderators

Remove subfolder just for member profiles?

Postby redactuk » Thu Nov 08, 2012 11:41 am

We currently have our forums installed in a subfolder called forums, and for most URL rewriting we are happy with forums being included in the URL, so we do not use the option to remove this. However, is it possible to just do this for member profiles? So, instead of:

Code: Select all
http://www.mydomain/forums/member/redactuk/


show

Code: Select all
http://www.mydomain/member/redactuk/


but still include the /forums/ base for everything else.

Thanks
Last edited by redactuk on Thu Nov 15, 2012 1:06 am, edited 1 time in total.
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Advertisement

Re: Remove subfolder just for member profiles?

Postby gizik » Sun Nov 11, 2012 12:10 pm

<spammer>
gizik
 
Posts: 3
Joined: Sun Nov 11, 2012 12:03 pm

Re: Remove subfolder just for member profiles?

Postby redactuk » Sun Nov 11, 2012 10:39 pm

*Bump*
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Re: Remove subfolder just for member profiles?

Postby redactuk » Wed Nov 14, 2012 6:10 pm

Guys, I appreciate you are busy, and you are not obliged to support or help anyone, but I really would appreciate some help with this one.

Thanks
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Re: Remove subfolder just for member profiles?

Postby redactuk » Sun Nov 18, 2012 1:36 pm

*bump*
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Re: Remove subfolder just for member profiles?

Postby redactuk » Thu Nov 29, 2012 11:54 am

still no one able to help me with this?
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Re: Remove subfolder just for member profiles?

Postby HB » Thu Nov 29, 2012 8:13 pm

If you don't use virtual folders, I don't see an easy way of eliminating the forum root prefix from the URL as a special case for members only. I looked at phpbb_seo_class.php:

Code: Select all
   function set_user_url( $username, $user_id = 0 ) {
      if (empty($this->seo_url['user'][$user_id])) {
         $username = strip_tags($username);
         $this->seo_url['username'][$username] = $user_id;
         if ( $this->seo_opt['profile_inj'] ) {
            if ( $this->seo_opt['profile_noids'] ) {
               $this->seo_url['user'][$user_id] = $this->seo_static['user'] . '/' . $this->seo_url_encode($username);
            } else {
               $this->seo_url['user'][$user_id] = $this->format_url($username,  $this->seo_delim['user']) . $this->seo_delim['user'] . $user_id;
            }
         } else {
            $this->seo_url['user'][$user_id] = $this->seo_static['user'] . $user_id;
         }
      }
   }


It only generates the suffix (member/username_x), not the whole URL (http://www.mysite.com/forums/member/username_x. It's a major hack, but you could try fooling URL generation by adding ".." to the suffix:

Code: Select all
   var   $seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'urpost' => 'unreadposts', 'pagination' => 'page', 'gz_ext' => '.gz' );


Becomes:

Code: Select all
   var   $seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => '../member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'urpost' => 'unreadposts', 'pagination' => 'page', 'gz_ext' => '.gz' );


If this works (ha!), you'd have to update the .htaccess to rewrite /members/* to /forums/members/*.
Dan Kehn
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1504
Joined: Mon Oct 16, 2006 2:25 am

Re: Remove subfolder just for member profiles?

Postby redactuk » Thu Nov 29, 2012 11:46 pm

Thank you for reply, I'll give that a go.
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm

Re: Remove subfolder just for member profiles?

Postby redactuk » Sat Feb 09, 2013 1:57 pm

Finally got around to trying to implement this. While the change about does work for the URL, I'm really stuck as to what change to make in htaccess to ensure clicking the link still goes to the profile. Unfortunately I'm no expert on rewrites. I was assuming it was simply a case of:

Code: Select all
RewriteRule ^forums/member/([^/]+)/?$ /forums/memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]


to

Code: Select all
RewriteRule ^member/([^/]+)/?$ /forums/memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]


But that doesn't work. Any pointers much appreciated :)
redactuk
 
Posts: 24
Joined: Tue Mar 22, 2011 4:04 pm


Return to phpBB mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Google Adsense [Bot] and 13 guests