Rewrite rule not working - causing frame inside frame (mod rewrite)

Discussion in 'Apache' started by kumakumasan, Oct 18, 2008.

  1. #1
    I'm trying to integrate phpBB forums with Drupal. The phpBB application lives at htdocs/forum; Drupal lives at htdocs/

    I installed a module that allows accessing phpBB from Drupal within a frame at mysite.com/phpbbforum.

    I want users to be able to copy a link in the forums and paste it in an email for example, however the links all point to the stand-alone phpBB application. In other words, if a user copies a link while browsing the forums, they copy mysite.com/forum/viewfroum.php?f=11 for example. Then if they try to use this link, it will go directly to the forums site without being in the Drupal frame.

    I tried to use the following RewriteRule:
    RewriteRule ^forum/(.*)$ phpbbforum/$1 [L,QSA]
    Code (markup):
    but it puts another instance of the site (with no forums) inside the frame that usually contains the forum.

    Here is Drupal's .htaccess RewriteRule:
    # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
    Code (markup):
    I tried putting my RewriteRule before and after this rule; both resulted in the same behavior as mentioned above.

    Please help! I'd really like to understand why this isn't working.

    Thank you!
     
    kumakumasan, Oct 18, 2008 IP
  2. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try putting [R] with your rewrite rule like this:
    RewriteRule ^forum/(.*)$ phpbbforum/$1 [R,L,QSA]
    Code (markup):
     
    Ladadadada, Oct 20, 2008 IP
  3. kumakumasan

    kumakumasan Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much for your reply!

    I tried your suggestion and when I go to mysite/phpbbforum I get a page not found inside the frame which is usually there. To recap, normally when I go to mysite/phpbbforum I see the forums inside a frame.

    Also, with your suggestion, if I copy a link and paste it, I get a page not found, with a URL of "http://mysite.com/Applications/MAMP/htdocs/phpbbforum/viewforum.php?f=29" To recap, I usually when I copy and paste a link of mysite/forum I go directly to that page outside a frame (goal: paste link and it goes to correct location inside frame, e.g., paste forum/viewtop... goes to phpbbforum/viewtop...).

    I'm sorry if this is confusing. Here's my file structure:
    htdocs/(drupal installation contents)
    htdocs/forum/(standard phpBB3 files)

    There's a Drupal module which allows Drupal users to auto-log into a phpBB forum. This module must create some kind of alias at mysite/phpbbforum (since there's no actual files at htdocs/phpbbforum).

    Please let me know if I can provide any further information. Thank you again for your reply. I've been struggling with this for weeks.
     
    kumakumasan, Oct 21, 2008 IP
  4. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hmm... halfway there. I need some more information.

    What did the link look like when you cut-and-pasted it ?

    You said it ended up here: "http://mysite.com/Applications/MAMP/htdocs/phpbbforum/viewforum.php?f=29" but what did it look like when it started ?
     
    Ladadadada, Oct 29, 2008 IP
  5. kumakumasan

    kumakumasan Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm happy to see your reply!

    Here's the constant URL when browsing the forums in the frame:
    http://intranet.d-kitchen.com/phpbbforum

    Here's the URL when copying a link in the frame:
    http://mysite.com/forum/viewtopic.php?f=31&t=11

    When pasted in a browser, this goes directly to the forums (no frame).

    If I change it to:
    http://mysite.com/phpbbforum/viewtopic.php?f=31&t=11

    It goes to the forums in the frame.

    I wrote a more detailed request here if any of this helps:
    http://forums.devshed.com/apache-development-15/mod-rewriterule-frames-and-aliases-566394.html

    Thank you!!
     
    kumakumasan, Oct 31, 2008 IP