Please help with htaccess

Discussion in 'Apache' started by monumentplayer, Feb 18, 2008.

  1. #1
    I am trying more than 2h! and I give up :(

    How make .htaccess for this:

    I want mysite.com/abc from mysite.com/index.php?query=abc

    mysite.com/MYTEXT ===>>>> mysite.com/index.php?query=MYTEXT
     
    monumentplayer, Feb 18, 2008 IP
  2. newzone

    newzone Well-Known Member

    Messages:
    2,865
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #2
    to be redirected from mysite.com/index.php?query=MYTEXT to mysite.com/MYTEXT
    ... or just look like mysite.com/MYTEXT

    is a script ?
     
    newzone, Feb 18, 2008 IP
  3. monumentplayer

    monumentplayer Peon

    Messages:
    342
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I want good links like mysite.com/abc
    and these links will run mysite.com/index.php?query=abc in fact :)

    thanks in advance
     
    monumentplayer, Feb 18, 2008 IP
  4. newzone

    newzone Well-Known Member

    Messages:
    2,865
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #4
    i think is a script and i think is more than changing the .htaccess :(
     
    newzone, Feb 18, 2008 IP
  5. monumentplayer

    monumentplayer Peon

    Messages:
    342
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    newzone

    When I open mysite.com/ABC i want text ABC in the title for example ...
     
    monumentplayer, Feb 18, 2008 IP
  6. newzone

    newzone Well-Known Member

    Messages:
    2,865
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    135
    Digital Goods:
    1
    #6
    you want seo friendly url ,
    mysite.com/dance, mysite.com/jazz e.t.c ...

    I'm sorry i don't know how i said , because if is a script like phpld (example) can't be done only with .htaccess
     
    newzone, Feb 18, 2008 IP
  7. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Sure it can... there's a sticky at the top of this section with hundreds of people asking exactly the same question as you and receiving answers.

    The short version is:
    RewriteRule ^abc$ index.php?query=abc [NC]
    Code (markup):
    You can do much smarter stuff with rewrites but that will give you what you want.

    If you want everything to go through index.php then you need a slight change:
    RewriteRule ^(.*)$ index.php?query=$1 [NC]
    Code (markup):
    Don't forget to turn the rewrite engine on in the first line of your .htaccess:
    RewriteEngine On
    Code (markup):
     
    Ladadadada, Feb 22, 2008 IP