Forum Moderators: phranque

Message Too Old, No Replies

quick redirect question

         

storemike

4:53 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Hi, I'm running Apache 1.3.28 on Solaris and need to redirect all requests inside a given directory, let's call it /bob, (including all subdirectories) to /bob/index.php

Code:
Redirect permanent /bob [myschool.edu...]

creates a loop, and using the NS option makes no difference

Code:
Redirect permanent /bob [myschool.edu...] [NS]

Since some subdirectories have index.php, my attempt at RedirectMatch with /bob/(!index.php) allows them to get through.

Can anyone point me in the right direction?

Thanks,
Mike

jdMorgan

6:26 pm on Mar 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



storemike,

Welcome to WebmasterWorld!

> Can anyone point me in the right direction?

I'd recommend using mod_rewrite:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/bob/index\.php$
RewriteRule ^bob/ http://www.example.com/bob/index.php [R=301,L]

The RewriteCond prevents redirection if the requested URL is already equal to /bob/index.php

Jim

storemike

7:13 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



hmmm...that didn't work. All pages got through. I might just choose to redirect to a copy of the index page in a bob_redirect folder. This redirecting is a temporary situation, anyway, and will only last until July 1st.

Thanks,
Mike