Search engine friendly URL's

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fastforward
    Senior Member
    • Nov 2000
    • 1013

    Search engine friendly URL's

    A while ago we had a conversation here about making the URL's on the forums search engine friendly. If anyone's interested I've set up http://dbforums.com like this very easily using mod_rewrite and editing a few templates. There's no need to change all the links, in fact it's a bad idea to do that or you'll get the spiders crawling your site all day and killing your server .

    All you have to us edit the forumhome and forumdisplay templates (which ones exactly depends on how many levels you have your forums) and change the links to something like this:
    Code:
    $ bburl/f$ forum[forumid]/s$ session[sessionhash]
    for forums, and
    Code:
    $ bburl/t$ thread[threadid]/s$ session[sessionhash].html
    for threads, (without the spaces)

    Then add these entries in your httpd.conf:
    Code:
    RewriteEngine on
    RewriteRule ^/f([0-9]+)/s([^/]+?)$ /forumdisplay.php?forumid=$1&s=$2 [L]
    RewriteRule ^/t([0-9]+)/s([^/]+?)\.html$ /showthread.php?threadid=$1&s=$2 [L]
    RewriteRule ^/s([^/])+?/$ /index.php?s=$1 [L]
    and finally add the following line in your header template:
    Code:
    <base href="$bburl">
    Just changing those templates is enough for a search engine to spider all your threads.

    Now your links on the front page should like this:
    /f5/s817784f8f65038e37835caa4d05a8a10

    This is all assuming you have mod_rewrite installed and enabled obviously.
    Last edited by fastforward; Thu 17 May '01, 8:50pm.
    http://britishexpats.com/ - British expatriate community
  • Eficrx
    Member
    • May 2001
    • 46

    #2
    that is a good idea.

    Comment

    • garymill
      Member
      • May 2001
      • 30

      #3
      No access to httpd.conf use .htaccess instead?

      I do not have access to the httpd.conf file, can this be done via
      the .htaccess file instead?

      Thanks,

      Gary

      Comment

      • fastforward
        Senior Member
        • Nov 2000
        • 1013

        #4
        Re: No access to httpd.conf use .htaccess instead?

        Originally posted by garymill
        I do not have access to the httpd.conf file, can this be done via
        the .htaccess file instead?
        It can.. but there's a performance hit. According to the official documentation, Apache has to 'use a trick' to get it to work using htaccess. I have no idea what the trick is or what sort of performance hit you take.
        http://britishexpats.com/ - British expatriate community

        Comment

        • TechGuy
          Senior Member
          • Mar 2001
          • 115
          • 3.7.x

          #5
          Does this work alright with 2.2.1? Also, will it cause problems with threads of multiple pages?

          Comment

          • George L
            Former vBulletin Support
            • May 2000
            • 32996
            • 3.8.x

            #6
            Originally posted by TechGuy
            Does this work alright with 2.2.1? Also, will it cause problems with threads of multiple pages?
            this is a hack and hacks are now discussed over at vbulletin.org

            and it works with 2.2.x but no multiple pages it will only display the short url for the first page in the thread and other pages in the thread will be as normal
            :: Always Back Up Forum Database + Attachments BEFORE upgrading !
            :: Nginx SPDY SSL - World Flags Demo [video results]
            :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

            Comment

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