htaccess rewrite rules

Discussion in 'XenForo' started by Jim McClain, May 19, 2017 at 2:18 PM.

  1. Jim McClain

    Jim McClain Senior Citizen

    1,815
    807
    +372
    This is a duplicate of a post I made on xenForo, but I realize some htaccess wizards may not visit that site often.

    I would like to create some redirects to new URLs when I convert my forum from vB 3.8 and vBSEO to xenForo 1.5 that will minimize any loss of backlinks. Here is a list of example URLs currently used on my vB forum:

    Forum root installation: /community/
    Forum category: /community/#category-name/ (it does not go to a separate page, but automatically scrolls to the category)
    Forum name: /community/carpet-q-and-a/ (this is accomplished the same way using the optional URL Portion in the node tree)
    Thread name: /community/carpet-q-and-a/20776-need-help-with-new-carpet.html (I understand xF doesn't use the forum name or the .html extension in the URL, so I need to redirect that to /community/thread/20776-need-help-with-new-carpet/)
    Thread name with additional pages: /community/carpet-q-and-a/20776-need-help-with-new-carpet-2.html (note the -2 added to the thread title - so I would have to redirect that in a similar fashion to the previous rule, or just redirect to the first page of a multi-page thread)

    Can you help me out with some example htaccess rules? Would I need a separate rule for threads in each specific forum? Will it be possible to create URLs that use the thread ID at the beginning of the thread slug and with a dash instead of a dot?

    Thanks for any help you can provide.
     
  2. Maddox

    Maddox Adherent

    412
    72
    +281
    I would suggest you visit http://www.htaccessredirect.net/

    That will generate a redirect system for you then if you want additional redirects you could just copy a paste using the generated file as a resource.

    It's a useful system to get to grips with the syntax that you need.

    Hope that helps you

    :)
     
  3. Jim McClain

    Jim McClain Senior Citizen

    1,815
    807
    +372
    As far as I can tell, that will create redirects for specific pages, but not for dynamically created pages like you find on forums - those that use thread ID numbers, page numbers and the odd (to me) code used like wildcards so you don't have to write individual 301s for every thread and thread page you have. Am I missing something?
     
  4. Digital Doctor

    Digital Doctor Tazmanian

    4,409
    397
    +1,682
    Post on Xenforo.com - jake bunce is the master.
     
  5. ozzy47

    ozzy47 Moderator

    9,038
    742
    +4,235
    Ahem:
     
  6. Jim McClain

    Jim McClain Senior Citizen

    1,815
    807
    +372
    No reply from JakeJake yet.
     
    Last edited: May 19, 2017 at 8:22 PM
  7. mysiteguy

    mysiteguy Habitué

    1,905
    867
    +1,244
    Depending on the VB SEO setup you have, rewrite rules may not cover it all. I've had to write PHP code which does redirects for certain types of VB SEO setups in these cases. Good luck with it. :)
     
  8. Jim McClain

    Jim McClain Senior Citizen

    1,815
    807
    +372
    I've got it all worked out already. Thank you.
     
Verification:
Draft saved Draft deleted