Forum Moderators: phranque
eg/
www.domain.com/subdir -> www.domain.com/newsubdir/index.php
www.domain.com/subdir/ -> www.domain.com/newsubdir/index.php
www.domain.com/subdir/page.php -> www.domain.com/newsubdir/index.php
www.domain.com/subdir/page.htm -> www.domain.com/newsubdir/index.php
www.domain.com/subdir/file.txt -> www.domain.com/newsubdir/index.php
so a catch-all for anything called from the subdir to redirect to the index page of the newsubdir.
my current .htaccess which resides in root contains the following:
**********
RewriteEngine on
Redirect permanent /subdir/ [domain.com...]
**********
which of course only captures the one specific requested url.
As you can probably tell i am fairly new to the htaccess stuff, so i am sorry if this is an obvious one.
paul.
try this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/subdir /newsubdir/index.php [R]
note:
- this will also catch something like www.domain.com/subdirfoo
as well as something like www.domain.com/subdir/foodir/what.ever
- this will do a temporary external redirect.
use [R=301] for permanent redirect or drop the [R] for internal redirect.
you should check out the Library and Charter links for this forum - lot's of good resources there....
ok, I don't think my server likes ReWriteRule. Whenever i use that, it either gives me my 404 page or a 500 error, depending on what other stuff i have put in htaccess.
I have it almost working how i wish. i have the following in htaccess:
Options +FollowSymLinks
RewriteEngine on
Redirect permanent /subdir/ [domain.com...]
so going to /subdir/foo.htm takes me to /newsubdir/foo.htm
however i want all pages to redirect to the index page. so i updated htaccess to the following:
Options +FollowSymLinks
RewriteEngine on
Redirect permanent /subdir/ [domain.com...]
but then if i go to /subdir/foo.htm it redirects me to /newsubdir/index.phpfoo.htm
:(
am i missing something? it feels like it would be some small bit of code, just to say "ok, the directory is one we need to redirect, there is some kind of file/page request, but we'll send them to the index page of the new directory anyway".