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

XF 1.4 VB4 Directs Broken

Discussion in 'Troubleshooting and Problems' started by Chad, Jan 2, 2015.

  1. Chad

    Chad Active Member

    Hi folks,

    Imported yesterday from VB4 after 10 years of use. Finalizing everything and realized the redirect is not working. Using the documented redirect suggestion here: https://xenforo.com/community/resources/vbulletin-4-x-url-redirection.120/

    They don't work at all.

    Example old links from VB4

    http://www.talkjesus.com/bible-study/49961-bible-alcohol.html
    http://www.talkjesus.com/sermons/49866-hey-jealousy.html
    http://www.talkjesus.com/bible-study/50636-prayer-worship-saints-mary-biblical.html
    http://www.talkjesus.com/press-stand/50726-community-transformation.html

    Basically none of the old links work.


    My old htaccess from VB4 was:

    Code:
    RewriteEngine On
    
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
    RewriteRule (.*) http://www.mydomain.com/$1 [L,R=301]
    
    RewriteRule ^((archive/)?(.*\.php(/.*)?)?)$ dbseo.php [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ dbseo.php [L,QSA]
    
    ## Rewrites
    <ifmodule mod_rewrite.c>
    RewriteEngine on
    Options +FollowSymlinks
    
    RewriteCond %{REQUEST_FILENAME} -s [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} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    
    # MVC
    RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
    
    </ifmodule>
    
    ## Expires
    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType application/x-javascript "access plus 1 year"
    </ifModule>
    
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>


    The current one in XF root folder 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 /
    
    # This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Chad

    Chad Active Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Your thread ids are the same, so you can redirect those URLs using pure rewrites:

    Add these rules to the top of the .htaccess file in your web root ( http://www.talkjesus.com/ ):

    Code:
    RewriteEngine On
    
    RewriteRule ^[^/]+/([0-9]+)-[^\.]+\.html$ /index.php?threads/$1/ [R=301,L]
    
    XF doesn't have forum slugs in thread URLs.

    You can remove the index.php by enabling friendly URLs:

    https://xenforo.com/help/friendly-urls/
     
    Chad likes this.
  5. Chad

    Chad Active Member

    Perfect that works. Thanks!

    PS: so this should avoid any SEO drops with Google correct?
     
  6. Chad

    Chad Active Member

    So there's no way to integrate that? It looks nice and good for SEO from my understanding
     
  7. Chad

    Chad Active Member

    Hey just a note, having a hiccup here

    One of the sub-forums shows up like this link (and 404) after I enabled frienldy URLs

    http://www.talkjesus.com/#bible-chat.4
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Possible conflict with your old vB forum which was in the same directory. Do you have another index file in the web root besides index.php? Or maybe vB's .htaccess file is in play.

    Or try enabling this option to change those category links:

    Admin CP -> Home -> Options -> Node & Forum List -> Create Pages for Categories
     
    Chad likes this.
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It would be an addon. I am not aware of an existing addon for this.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yes.
     
    Chad likes this.
  11. Chad

    Chad Active Member

    Actually, yes. index.html only for my members/guests (placeholder while I finalize my XF install, config). But would that cause this? I'm thinking no,

    Another example: http://www.talkjesus.com/#general-lounge.8

    This is the current .htaccess

    Code:
    RewriteEngine On
    RewriteRule ^[^/]+/([0-9]+)-[^\.]+\.html$ /index.php?threads/$1/ [R=301,L]
    
    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 /
    
        #    This line may be needed to enable WebDAV editing with PHP as a CGI.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>
     
  12. Chad

    Chad Active Member

    You're awesome. This fixed it :D
     
  13. Chad

    Chad Active Member

    Good grief...

    Now it added the /forum/ slug to talkjesus.com/forum/ after I enabled that. Normal? Can we remove the slug while keeping the "create pages" enabled?
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I assume you mean /forums/

    The "forums" route is used for all forum links. It can be changed using route filters but not completely removed:

    https://xenforo.com/community/threads/route-filters.47946/
     

Share This Page