I have a server. (Apache).
On this server there is a subdirectory (subdir1). In this subdirectory, I have an .htaccess file. How can I set up this .htaccess file to redirect me from the directory it is in (regardless of what the directory is called) to a specific subdirectory?
Redirect {current .htaccess directory} {current .htaccess direcotry}/subdir2/subdir3
Or something like that?
Thanks in advance!
Are you sure you want a redirect? If you redirect from
/subdir1to/subdir1/subdir2, you are still inside/subdir1, so quite clearly you’ll get another redirect to/subdir1/subdir2/subdir2, then/subdir1/subdir2/subdir2/subdir2, and so on until the browser gives up. (As you say in your comment to Sacx’s answer.)If you want to redirect into
/subdir1/subdir2, you’ll have to excludesubdir2from matching the redirect, for example something like:this is pretty ugly though. It’s unusual to want to do a redirect from a directory to a subdirectory of itself. Are you sure you really want a redirect? If you just want to make files physically located under
/subdir1/subdir2/filelook visible as/subdir1/file, I think what you’d want would really be an Alias: