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.
  2. Better Analytics for WordPress Get It Free

Dynamic URL redirect

Discussion in 'Apache' started by fokakmeny, Feb 24, 2012.

  1. #1
    Hello there;
    in my website, I use the root directory for my main script "vBulletin"
    now I want to move my vBulletin script into a child-directory "forums" and use the main dir for another script.
    I use vBseo for URL re-writing and the option I use for re-writing is

    t[thread_id]/[thread_title].html
    Code (markup):
    example

    http://www.example.com/t20836/thread-title.html
    Code (markup):
    RECOMMENDED

    I want to move it to

    http://forums.example.com/t20836/thread-title.html
    Code (markup):
    or


    please not, that I can't use this mod_rewrite

    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://forums.example.com/forums/$1 [R=301,L] 
    
    Code (markup):
    because if I did I won't be able to use the main directory of my domain

    I think if we could find a way to get the [thread_id] from the folder name and redirect the visitor to
    /forums/showthread.php?t=[thread_id]
    I think then the problem will be solved.
    Any ideas? :)
    hope someone can help.
     
    fokakmeny, Feb 24, 2012 IP
  2. fokakmeny

    fokakmeny Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Problem solved using

    
    RewriteEngine On 
    Options +Indexes
    Options +FollowSymlinks
    RewriteRule ^t(.*)/(.*)\.html$ http://www.example.com/forums/showthread.php?t=$1 [R=301]
    
    Code (markup):
    I've found that solution after 5 hours googling and reading different articles, and actually this one was the most helpful.
    http://forums.digitalpoint.com/showthread.php?t=23044
    Code (markup):
     
    fokakmeny, Feb 24, 2012 IP
  3. Ultrabooked

    Ultrabooked Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That is the best solution to this kind of redirect problems. With it you match only the files you want. It should work fine.
     
    Ultrabooked, Feb 25, 2012 IP