1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

mod_rewrite for 301 redirect.

Discussion in 'Apache' started by ServerUnion, Sep 28, 2005.

  1. #1
    Had a domain that I am changing the struture on, what I need is the following.

    There are a limited number of subdirectories, but a large structure under them. All these need to be given a 301 to the homepage.

    www.xxxx.com/World/ --> www.xxxx.com
    www.xxxx.com/World/{many levels under here} --> www.xxxx.com

    There are about 2K directories that I would just like a 301 to the homepage.

    Thanks for the help...
     
    ServerUnion, Sep 28, 2005 IP
  2. forkqueue

    forkqueue Guest

    Messages:
    401
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    RewriteEngine On
    RewriteBase /
    Redirect permanent /World/.* http://www.xxxx.com/
    
    Code (markup):
    Should do the trick..
     
    forkqueue, Sep 28, 2005 IP
  3. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the tip, but it seems not to be picking up the wildcards. It works for just www.xxxx.com/World/ but not any directories under it. Basically anything in the directories I specify should have a 301 to the homepage.

    Anyone know the wildcard to put it so that after say /World/ is doesn't matter what the directory is?

    Thanks...
     
    ServerUnion, Sep 29, 2005 IP
  4. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I tried something like this with no resolution:

    RewriteCond %{REQUEST_URI} ^/World/
    RewriteRule ^(.*) http://www.XXXX.net [L]
    RewriteCond %{REQUEST_URI} ^/World/(.*)
    RewriteRule ^(.*) http://www.XXXX.net [L]

    Any help appreciated.
     
    ServerUnion, Sep 29, 2005 IP