#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    78
    Rep Power
    0

    Redirect 301 several pages to a folder


    Hi,
    I wonder if there is a shorthand to redirect pages with similar url like this to a folder, this is because there are many pages and I dont want to do the 301 one by one if possible:

    example.com/pagesabout_blue.php
    example.com/pagesabout_red.php
    etc.
    These pages I would like to redirect to
    example.com/about/pagesabout_blue.php
    example.com/about/pagesabout_red.php

    is there a way to redirect example.com/pagesabout_whatever ?

    If posible I would like to do the same in some folders, so would be from folder to folder like this also:
    example.com/folder/pagesabout_blue.php
    example.com/folder/pagesabout_red.php
    etc.
    These pages I would like to redirect to
    example.com/aboutanother/pagesabout_blue.php
    example.com/aboutanother/pagesabout_red.php

    Thanks
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    29
    Rep Power
    0
    I believe you need to investigate .htaccess rules which can do this but you may also be able to put those statements into the configuration files too. Not very good on this, sorry.
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,295
    Rep Power
    9400
    If you wanted to redirect everything in a folder to another folder then what would be really easy. Except for the root folder.

    Otherwise mod_alias (or mod_rewrite) can do pattern matching. In your root .htaccess,
    Code:
    RedirectMatch ^/(pagesabout_.*\.php)$ /about/$1
    RedirectMatch ^/folder/(pagesabout_.*\.php)$ /aboutanother/$1

IMN logo majestic logo threadwatch logo seochat tools logo