simple mod rewrite assistance required

Discussion in 'Apache' started by mcfox, Jan 2, 2007.

  1. #1
    Can anyone help me with a simple mod rewrite? I've already given the server some, er, issues, with my attempts to do this. Dunno what's going wrong, exactly.

    I want to redirect anyone who lands on the domain, e.g. domain.com, to a sub folder called wiki.

    That's it. If you land on the domain, www.example.com, I want to send you to www.example.com/wiki/index.php
     
    mcfox, Jan 2, 2007 IP
  2. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #2
    I think it's not about mod_rewrite but redirect only ;)
    Put the following code into your .htaccess file which is located in root.
    Redirect / /wiki/index.php
    Code (markup):
    Hope it helps!
    -Richie
     
    Richie_Ni, Jan 2, 2007 IP
  3. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #3
    Thanks Richie but I have tried that already and it just gives the server kittens, producing an Internal Server Error.

    I've also tried using
    Redirect index.html http://www.mydomain/wiki/index.php
    Code (markup):
    simply doesn't work for some reason.

    It may be that my host is limiting some .htaccess commands, I'm not sure.

    I do know that I can apply a mod rewrite - I just don't know how.
     
    mcfox, Jan 2, 2007 IP
  4. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #4
    If you could use php or asp then change your index.html to index.php and you could do redirect manually using

     
    ketan9, Jan 2, 2007 IP
  5. ketan9

    ketan9 Active Member

    Messages:
    548
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Actually it is header() & not location() function that you should use..
     
    ketan9, Jan 2, 2007 IP
  6. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #6
    That's a bit odd,try
    Redirect [COLOR=Red]/[/COLOR]index.html http://www.mydomain/wiki/index.php
    Code (markup):
    Yea,with a slash.
    It works good in my personal blog!I don't think your host would limit this kind of things :)
    P.s:I'd like to know your site if you don't mind ;)
     
    Richie_Ni, Jan 2, 2007 IP
  7. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #7
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^$ http://www.domain.com/wiki/ [R=301,L]

    might do it.
     
    Nintendo, Jan 2, 2007 IP
    mcfox likes this.
  8. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #8
    Sorry, confidential at the mo. ;)

    Thanks Nintendo! Worked perfectly!

    [​IMG]
     
    mcfox, Jan 2, 2007 IP
  9. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #9
    Nintendo is just awesome!
    I thought it was about redirect,just got what you meant! :(
     
    Richie_Ni, Jan 3, 2007 IP
  10. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #10
    It is redirect. [R=301,L] 301 redirect. I just always do the mod_rewrite version.
     
    Nintendo, Jan 3, 2007 IP
  11. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #11
    :eek:
    But why the code I gave her didn't work?:confused:
     
    Richie_Ni, Jan 3, 2007 IP
  12. mcfox

    mcfox Wind Maker

    Messages:
    7,526
    Likes Received:
    716
    Best Answers:
    0
    Trophy Points:
    360
    #12
    Pssst, Richie! I'm a dude with a chick avatar! Shoemoney said it was the thing to do ;)
     
    mcfox, Jan 3, 2007 IP
  13. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #13
    I have much better luck with mod_rewrite than that redirect stuff!!! Notice I don't even mention 'redirect' in the mod_rewrite faq!!!!
     
    Nintendo, Jan 3, 2007 IP
  14. Richie_Ni

    Richie_Ni Illustrious Member

    Messages:
    10,721
    Likes Received:
    1,175
    Best Answers:
    0
    Trophy Points:
    410
    #14
    Sorry,I didn't know that!:(
     
    Richie_Ni, Jan 3, 2007 IP
  15. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #15
    Where is your mod_rewrite faq ?
     
    login, Jan 6, 2007 IP
  16. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #16
    JEET, Jan 6, 2007 IP