1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

301 redirect / mod rewrite help please

Discussion in 'Apache' started by Bernard, Jul 28, 2019.

  1. #1
    I'm in the process of migrating one of my vB 3.8 forums to Xenforo. I will be importing all the data into a clean install, so the thread and post IDs will remain the same. I need some help with mod rewrite rule(s) that would cover the following:

    Old:  www.domain.com/forums/f23/thread-title-1255/
    New:  www.domain.com/threads/thread-title.1255/
    
    Old: www.domain.com/forums/f23/thread-title-1255/index2.html
    New: www.domain.com/threads/thread-title.1255/page-2
    
    Old: www.domain.com/forums/f23/thread-title-1255/index2.html#post60948
    New: www.domain.com/threads/thread-title.1255/post-60948
    Code (markup):
    /forums/f#/ should become /threads/ (f# could be f23, f18, etc.)
    -threadid should become .threadid

    Ideally, index#.html becomes page-# when there is no post id, but if this is too complicated, I can live with simply ignoring index#.html and redirecting to the first page.
    SEMrush
    #postid should become /post-id

    Any help would be greatly appreciated.
     
    Bernard, Jul 28, 2019 IP
    SEMrush
  2. mmerlinn

    mmerlinn Notable Member

    Messages:
    2,242
    Likes Received:
    283
    Best Answers:
    6
    Trophy Points:
    260
    #2
    A partial solution to the first one could be this, however there must be a better way since every occurance of f# would need to be listed:

    Rewrite 301 /forums/f18 /threads
    Rewrite 301 /forums/f23 /threads


    The rest of what you want should be easy enough, except it is above my pay grade so I have no clue how to do it.

    If nothing else, this might nudge you off square one.
     
    mmerlinn, Jul 28, 2019 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    5,852
    Likes Received:
    1,085
    Best Answers:
    22
    Trophy Points:
    400
    #3
    Post it on stackoverflow.
     
    qwikad.com, Jul 28, 2019 IP
  4. Bernard

    Bernard Well-Known Member

    Messages:
    1,604
    Likes Received:
    107
    Best Answers:
    0
    Trophy Points:
    185
    #4
    Thanks folks. I got a response to my question on the Xenforo forums and there is a solution available via the forum's ACP. No need to mess with rewrite rules via .htaccess after all. Cheers.
     
    Bernard, Jul 28, 2019 IP
    qwikad.com likes this.
  5. mmerlinn

    mmerlinn Notable Member

    Messages:
    2,242
    Likes Received:
    283
    Best Answers:
    6
    Trophy Points:
    260
    #5
    So what is the solution?
     
    mmerlinn, Jul 28, 2019 IP
  6. Bernard

    Bernard Well-Known Member

    Messages:
    1,604
    Likes Received:
    107
    Best Answers:
    0
    Trophy Points:
    185
    #6
    The solution is to use Route Filters via the Xenforo Admin Control Panel. It sort of mimics the .htaccess functionality, but the processing is handled by the software.
     
    Bernard, Jul 28, 2019 IP