Resource icon

Redirection Scripts for Invision Power Board 3.x 4.0

No permission to download
When I go to an old URL it just redirects me to the home page. Any suggestions?

That usually means the import log table name is wrong in the 301config.php file. The name is usually one of these two:

xf_import_log
archived_import_log
 
Hello,

Does this script takes one or two steps from old to new threads?

I ask this because some boards go from:

from: /topic/1234-my-title/ (IPB)
to: /threads/1234/ (XF)
and finally: /threads/my-title.1234/ (XF)

Thanks
 
They would do 1 redirection to /threads/1234/ and then, if you have permission to view the thread, the final URL.
 
They would do 1 redirection to /threads/1234/ and then, if you have permission to view the thread, the final URL.

Is it possible to go from the original to the final one without passing /threads/1234/?

I'm not an expert but my understanding is that we should avoid multiple 301 redirects.
 
To do what you're after would require code changes.

The differences in only having one redirect will generally be very minor. They're all done with 301 redirects which should pass the "link juice" through (a very small amount may be lost from what people at Google have said).
 
Hi @Mike,

This is what I got using nginx and retaining id's when importing content:

Code:
rewrite ^/forum/(\d+)-(.+)/page-(\d+)$ /forums/$2.$1/page-$3? permanent; # forum page
rewrite ^/forum/(\d+)-(.+)/$ /forums/$2.$1/? permanent; # forum
rewrite ^/topic/(\d+)-(.+)/page-(\d+)$ /threads/$2.$1/page-$3? permanent; # topic page
rewrite ^/topic/(\d+)-(.+)/$ /threads/$2.$1/? permanent; # topic
rewrite ^/user/(\d+)-(.+)/$ /members/$2.$1/? permanent; # user

It works with one redirect. Only need the redirect script to redirect posts and attachments to avoid the evil if inside nginx configuration.

Any downside using these rules?
 
Last edited:
I'm having a tough time getting this to work. Please let me know your thoughts.

My old IPB forum is in domain/forums

My new XF forum is in domain/xf

My old IPB htaccess file is:
Code:
<ifModule mod_deflate.c>
    <filesMatch "\.(js|css|html|php)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</ifModule>


<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /forums/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /forums/index.php [L]
</IfModule>

The new htaccess file to redirect is:
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On
   

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /ip.board
   
    # IPS Rewrite Rules
    RewriteCond %{REQUEST_URI} /(topic|forum|user)/ [OR]
    RewriteCond %{QUERY_STRING} (^|&)show(topic|forum|user)= [OR]
    RewriteCond %{QUERY_STRING} ^/(topic|forum|user)/ [OR]
    RewriteCond %{PATH_INFO} ^/(topic|forum|user)/
    RewriteRule ^.*$ ips2xf.php [NC,L]

    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]
</IfModule>

I even tried remove the # from rewritebase /ip.board and it still didn't work.

Does the above new htaccess code look correct?

Thank you.
 
Add note: I also have the 301config.php file with the correct path to the $fileDir, so I don't think the problem is within that file.

I keep getting a 404 error.
 
Last edited:
@actionmedia

I assume that new "redirect" .htaccess file is in /forums (where IPB was). That would be the correct place.

The IPB redirect scripts need to go in the /forums directory (where IPB was). Then the 301config.php file needs to be edited to point to the XF directory.

The 404 error makes me think that stuff is in the wrong directory. But if it's in the right directory then RewriteBase might help you. Use this for the RewriteBase in the "redirect" .htaccess file in /forums:

Code:
RewriteBase /forums
 
Actually, the topics and forums redirect fine, however if you goto the old forum directory (/forums) it shows the IPB board still. Something still is not right...
 
Actually, the topics and forums redirect fine, however if you goto the old forum directory (/forums) it shows the IPB board still. Something still is not right...

In that .htaccess in /forums, after this block of code:

Code:
    # IPS Rewrite Rules
    RewriteCond %{REQUEST_URI} /(topic|forum|user)/ [OR]
    RewriteCond %{QUERY_STRING} (^|&)show(topic|forum|user)= [OR]
    RewriteCond %{QUERY_STRING} ^/(topic|forum|user)/ [OR]
    RewriteCond %{PATH_INFO} ^/(topic|forum|user)/
    RewriteRule ^.*$ ips2xf.php [NC,L]

...add this line:

Code:
RewriteRule .* /xf/? [R=301,L]

By putting that line after those redirect rules it will act as a catch all for any other IPB URLs that get through. All such URLs will get redirected to your XF index.
 
threads indexed in Google go to the new form index. If I type in the old thread url it redirects to the new thread. Are the Google indexed links supposed to go to the index?
 
threads indexed in Google go to the new form index. If I type in the old thread url it redirects to the new thread. Are the Google indexed links supposed to go to the index?

The google link must be something different that isn't handled by the rules. Can you provide an example link?
 
Im getting too many redirects... Any idea what would cause this?

Default files the only thing i changed was the table log name in 301. I feel like pulling my hair out.

I tried rewritebase /forum which is the folder of where xenforo is installed and invisionboard.
 
Im getting too many redirects... Any idea what would cause this?

Default files the only thing i changed was the table log name in 301. I feel like pulling my hair out.

I tried rewritebase /forum which is the folder of where xenforo is installed and invisionboard.

It might be a bad .htaccess file.

Can you post the link that is giving that error? I also need to see the .htaccess file.
 
Top Bottom