PDA

View Full Version : Global redirect possible?



ricks99
11-28-2006, 06:04 AM
I know I can create redirect in my .htaccess for a specific file:


Redirect /olddirectory/oldfile.html http://mysite.com/newdirectory/newfile.html

Is it possible to create a "global" redirect for all files in a specific directory? I tried:


Redirect /olddirectory/*.* http://mysite.com/newdirectory/newfile.html

But it didn't seem to work.

-R

Basil
11-28-2006, 09:25 AM
Single file

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^olddirectory/ http://yoursite.com/newdirectory/somefile.html

Directory

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^olddirectory/(.*)$ http://yoursite.com/newdirectory/$1

ricks99
11-28-2006, 09:40 AM
But this redirects the entire directory to a new directory...



Directory

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^olddirectory/(.*)$ http://yoursite.com/newdirectory/$1

What I want is to direct an entire directory to a specific file (which will/may be named differently than the original) -- not another directory. Is this possible?

Basil
11-28-2006, 10:04 AM
Single file

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^olddirectory/ http://yoursite.com/newdirectory/somefile.html