htaccess problem

Discussion in 'Site & Server Administration' started by mehdi, Nov 21, 2008.

  1. #1
    mehdi, Nov 21, 2008 IP
  2. level3hosting

    level3hosting Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are yiu using a control pane of any kind? Like cpanel for example?
     
    level3hosting, Nov 21, 2008 IP
  3. mehdi

    mehdi Peon

    Messages:
    258
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes Cpanel
     
    mehdi, Nov 22, 2008 IP
  4. abi

    abi Peon

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Was just coming to post the same question!!!

    So far i have found this:

    
    RewriteEngine On
    RewriteRule ^([A-Za-z0-9-]+)?$   page.php?s=$1
    
    Code (markup):
    This will redirect:

    www.site.com/1234

    to: www.site.com/page.php?s=1234


    BUT it stops working when someone puts a "/" at the end of the url..

    www.site.com/1234/ <-- will just break it.

    So if anyone can help more!

    Cheers.
     
    abi, Nov 22, 2008 IP
  5. mehdi

    mehdi Peon

    Messages:
    258
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks man its working

    RewriteRule ^([A-Za-z0-9-]+)?$ index.php?ref=$1
    RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?ref=$1
     
    mehdi, Nov 22, 2008 IP
  6. abi

    abi Peon

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6

    Haha, cool, so you just put the same line in again, with the "/" this time! Sweet. I was so close :) :p
     
    abi, Nov 23, 2008 IP
  7. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #7
    RewriteRule ^/?(\d+)/?$ /index.php?ref=$1 [L]
    Code (markup):
     
    joebert, Nov 24, 2008 IP