probably the simplest htaccess rewrite problem

Discussion in 'Apache' started by carlsberg, Oct 14, 2011.

  1. #1
    Hi

    I can do rewriting in htaccess but I'm having a problem working out the rule for the following:

    I'd like it to match

    passion-terroir.fr
    http://www.passion-terroir.fr
    http://www.passion-terroir.fr/

    but not

    http://www.passion-terroir.fr/bla
    http://www.passion-terroir.fr/bla/
    http://www.passion-terroir.fr/bla/bla
    http://www.passion-terroir.fr/bla/bla.php

    and then rewrite to index\.php?t=in&p_id=1

    I've tried a million combinations including

    RewriteRule ^passion-terroir\.fr$ index\.php?t=in&p_id=1 [NC]
    RewriteRule ^/$ index\.php?t=in&p_id=1 [NC]

    but nothing works - it should be incredibly simple ....

    any ideas ?

    thanks
     
    carlsberg, Oct 14, 2011 IP
  2. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #2
    How about this:
    
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^$ /index.php?t=in&p_id=1 [L]
    
    Code (markup):
    Cheers!
     
    pr0t0n, Nov 1, 2011 IP