Announcement

Collapse
No announcement yet.

replace user id with username in links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] replace user id with username in links

    Hi
    A few days ago I used to have an external seo plugin installed that made all links for members areas look like
    http://www.mysitei.com/forum/members/username/

    after I uninstalled the plugin, all these links switched to

    http://www.mysite.com/forum/member.php?u=*** (***=user id in numbers)

    How would I get the links to show the username rather than the Id (without installing external plugins)

    thanks
    ababneh
    Last edited by ababneh; Wed 25 Jul '12, 11:04pm.

  • #2
    You could try...

    This: https://www.vbulletin.com/docs/html/...ofriendly_urls

    mod_rewite friendly URL's may be the closest thing to match your needs without using a plugin or third-party solution.
    To be updated...

    Comment


    • #3
      Hi,
      I enabled mode-rewire from admincp and used the .htaccess file included in the dont_upload folder and now it changes the url to:
      http://www.mysitei.com/forum/members/ID-username/
      I am trying to get the mod to just use
      http://www.mysitei.com/forum/members/username/

      this is my .htaccss and I tried to change with the line
      Code:
       [COLOR=#333333]RewriteRule ^members/.* member.php [QSA] [/COLOR]
      but with no good knowledge of these rules I wasn't lucky to make it work to my liking
      Code:
      [COLOR=#333333]RewriteEngine on[/COLOR][COLOR=#333333]
      [/COLOR][COLOR=#333333]
      # If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
      # RewriteBase /forum/
      
      # If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
      # Options -MultiViews
      
      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      
      RewriteRule ^.*$ - [NC,L]
      
      # Forum
      RewriteRule ^threads/.* showthread.php [QSA]
      RewriteRule ^forums/.* forumdisplay.php [QSA]
      RewriteRule ^members/.* member.php [QSA]
      RewriteRule ^blogs/.* blog.php [QSA]
      RewriteRule ^entries/.* entry.php [QSA]
      
      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      
      RewriteRule ^.*$ - [NC,L]
      
      # MVC
      RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
      
      # Check MVC result
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteRule ^(.*)$ - [NC,L]
      RewriteRule ^(.*)$ - [R=404,L]
      [/COLOR]
      Last edited by ababneh; Wed 25 Jul '12, 11:05pm.

      Comment


      • #4
        There is an article over in the articles forum on vbulletin.org that tells you how to set this up on your site.

        Please don't PM or VM me for support - I only help out in the threads.
        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
        Want help modifying your vbulletin forum? Head on over to vbulletin.org
        If I post CSS and you don't know where it goes, throw it into the additional.css template.

        W3Schools <- awesome site for html/css help

        Comment


        • #5
          Originally posted by Lynne View Post
          There is an article over in the articles forum on vbulletin.org that tells you how to set this up on your site.
          I believe you referring to shorter profile url article

          and What is described there is to use the code
          Code:
          [LEFT][COLOR=#000000]RewriteEngine on
          [/COLOR][COLOR=#000000]RewriteRule ^/?([a-zA-Z0-9]+)$ member.php?username=$1 [L][/COLOR][/LEFT]
          My current .htacess file
          Code:
          RewriteEngine on
          
          # If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
          # RewriteBase /forum/
          
          
          # If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
          # Options -MultiViews
          
          
          RewriteCond %{REQUEST_FILENAME} -f [OR]
          RewriteCond %{REQUEST_FILENAME} -l [OR]
          RewriteCond %{REQUEST_FILENAME} -d
          
          
          RewriteRule ^.*$ - [NC,L]
          
          
          # Forum
          RewriteRule ^threads/.* showthread.php [QSA]
          RewriteRule ^forums/.* forumdisplay.php [QSA]
          RewriteRule ^members/.* member.php [QSA]
          RewriteRule ^blogs/.* blog.php [QSA]
          RewriteRule ^entries/.* entry.php [QSA]
          
          
          RewriteCond %{REQUEST_FILENAME} -f [OR]
          RewriteCond %{REQUEST_FILENAME} -l [OR]
          RewriteCond %{REQUEST_FILENAME} -d
          
          
          RewriteRule ^.*$ - [NC,L]
          
          
          # MVC
          RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
          
          
          # Check MVC result
          RewriteCond %{REQUEST_FILENAME} -f
          RewriteRule ^(.*)$ - [NC,L]
          RewriteRule ^(.*)$ - [R=404,L]
          I replaced the line
          Code:
          RewriteRule ^members/.* member.php [QSA]
          with
          Code:
          [LEFT][COLOR=#000000]RewriteRule ^/?([a-zA-Z0-9]+)$ member.php?username=$1 [L][/COLOR][/LEFT]
          but it didn't work. I even made my whole .htaccess look like

          Code:
          [COLOR=#000000][LEFT]RewriteEngine on
          [/LEFT]
          [/COLOR][COLOR=#000000][LEFT]RewriteRule ^/?([a-zA-Z0-9]+)$ member.php?username=$1 [L][/LEFT]
          [/COLOR]
          and from admincp > friendly url> I selected standard urls, but no luck
          It always assigns the link output with a "user id"-username like
          http://www.mysitei.com/forum/members/ID-username/

          it seems I have to take the ID part from some file or maybe from a portion of the code in .htacess

          anyone know how to do it
          Last edited by ababneh; Wed 25 Jul '12, 11:06pm.

          Comment


          • #6
            I misunderstood. I see now that you actually want to replace all of the links on your site. That article just makes it so the other method works to access the member page. Default vBulletin will add the userid into the link. If you wanted to remove it, that would require custom coding.

            Please don't PM or VM me for support - I only help out in the threads.
            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
            Want help modifying your vbulletin forum? Head on over to vbulletin.org
            If I post CSS and you don't know where it goes, throw it into the additional.css template.

            W3Schools <- awesome site for html/css help

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X