Ive read the FAQ but still confused :(

Discussion in 'Apache' started by pangea, Aug 2, 2007.

  1. #1
    Hi guys...

    Ive read the FAQ, but am still not convinced if what im trying to do is possible.

    I need all links that go to http://www.domain.com/area1
    AND ALL THE FILES in that directory/any subdirectory

    ie /area1/file.htm and area1/file2/file.htm

    to be automatically rediected to http://www.domain.com/area2

    is this possible?

    Cheers,
    Paul
     
    pangea, Aug 2, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    In your .htaccess file in your web root (create one if it doesn't exist):
    RedirectMatch 301 ^area1 http://www.domain.com/area2
    Code (markup):
    Or with mod_rewrite:
    
    Option +FollowSymLinks
    RewriteEngine On
    RewriteRule ^area1 /area2 [R=301,L]
    Code (markup):
     
    krt, Aug 2, 2007 IP
    pangea likes this.
  3. pangea

    pangea Guest

    Messages:
    557
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    wow thanx....u make it sound so easy!

    i'll try it out now, lol!
     
    pangea, Aug 6, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    You're welcome

    And it becomes very easy after some hours of working with and especially debugging .htaccess files with 500 errors being nearly the only feedback! :p
     
    krt, Aug 6, 2007 IP