1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

rewrite rules and redirections for VB4 mod rewrite URLs

Discussion in 'XenForo Questions and Support' started by jacko, Oct 9, 2010.

  1. jacko

    jacko Well-Known Member

    Is there any way of making proper redirection for people that used VB4 with mod rewrite urls and want to stick to the same server location?

    I will give you an example:

    1. original VB4 thread:/threads/5755-Cranesong-Analog-Dither
    2. new Xenforo thread: /threads/cranesong-analog-dither.4940/

    The potential problem I see is that both VB4 and Xenforo use "threads" in the url structure.
    One of the ideas I had was to change it to "thread" in Xenforo. Then the redirection script for VB3 would work fine:

    1. original VB4 thread:/threads/5755-Cranesong-Analog-Dither redirects to /showthread.php?t=5755
    2. /showthread.php?t=5755 redirects to Xenforo location /thread/cranesong-analog-dither.4940/
    If only I could change Xenforo to use /thread/ instead of /threads/ that would actually solve my problem.

    Another solution would be to install Xenforo in a sub directory. But I think it looks better for google if the Xenforo is in the server's root directory, doesn't it?
    ked38 likes this.
  2. jacko

    jacko Well-Known Member


    would it be possible to convert /threads/5755-Cranesong-Analog-Dither into /threads/cranesong-analog-dither.4940/
  3. David McHenry

    David McHenry Active Member

    Are you trying to run vBulletin and Xenforo at the same time? You can simply remove the vBulletin files and upload xenforo to the root if thats where you want it. It really doesnt matter where you place it on the site except for organizational purposes.

    Also check the mods forum there is a redirection script there see if it takes care of your needs.
  4. jacko

    jacko Well-Known Member

    I want to stop using VB and switch to XenForo - not using them simultaneously. Redirection scripts will only work if I decide not to use Advanced URL's (without index.php). That is my main concern. Unluckily XenForo is using the same advanced URL structure as VB4. If they could only change that from "forums" to "forum" and from "threads" to "thread" that would solve the issue.
  5. jacko

    jacko Well-Known Member

    Do you think it is possible to convert VB4 advanced URLs to Xenforo advanced URLs?
  6. jacko

    jacko Well-Known Member

    I found the solution that works!

    Basically I pasted VB4 rewrite conditions into the .htaccess file and it looks like this:
    <IfModule mod_rewrite.c>
        RewriteEngine On
    RewriteRule ^threads/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) showthread.php?t=$1&page=$2&%{QUERY_STRING}
    RewriteRule ^members/([0-9]+) member.php?u=$1&%{QUERY_STRING}
    RewriteRule ^forums/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) forumdisplay.php?f=$1&page=$2&%{QUERY_STRING}
    RewriteRule ^blogs/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) blog.php?u=$1&page=$2&%{QUERY_STRING}
    RewriteRule ^entries/([0-9]+)(?:/?$|(?:-[^/]+))(?:/?$|(?:/page([0-9]+)?)) entry.php?b=$1&page=$2&%{QUERY_STRING}
    RewriteRule ^list/([^/]*/)([0-9]+) list.php?r=$1$2&%{QUERY_STRING}
    RewriteRule ^content/(.*) content.php?r=$1&%{QUERY_STRING}
    RewriteRule ^widget/config/([0-9]+) widget.php?r=config/$1&%{QUERY_STRING}
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data|js|styles|install) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    I am using showthread.php file from this thread: http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/ which redirects to Xenforo threads. And now the old VB4 URLS get me directly to the same thread on Xenforo!
    Anthony Parsons likes this.
  7. Anthony Parsons

    Anthony Parsons Well-Known Member

    I will have to try this out when it comes time... as I would love to not lose a vast amount of traffic due to re-indexing... exactly the same as yourself, being redirect from 4.x mod_rewrite URL's to xenforo friendly URL's a requisite.
  8. gldtn

    gldtn Well-Known Member

    some of my links don't have the t after the showthread.php so instead of showthread.php?t=THREAD-ID it has showthread.php?THREAD-ID-THREAD-TITLE, does anyone know a work around for this?
  9. Luke F

    Luke F Well-Known Member

    Have you tried my addon for redirecting vB4 URLs?


    You should be fine with just the 'standard-basic-advanced' version

Share This Page