PDA

View Full Version : Help with redirect in Apache??


Errica
12-27-2008, 06:48 PM
I've moved an entire directory to another location in my site. How can I redirect any request (to any file or folder) within that directory, to the index page of the new folder?

Thanks!

abduraooft
12-28-2008, 12:05 PM
Just try

RewriteCond %{REQUEST_URI} !/new_directory/
RewriteRule ^(.*)$ /new_directory/$1 [L]
(assuming the new_directory is directly under your root, in the same domain)

Errica
12-28-2008, 06:30 PM
Hmm, not certain how that works. I see new_directory twice. If the existing directory on the first line?

abduraooft
12-29-2008, 07:03 AM
(assuming the new_directory is directly under your root, in the same domain) The fisrt line is a condition, which prevents continuous redirects to the new_directory, after a successful redirect. ie, it simply skips the redirect, if the request is actually to the new_directory.