redirections between directories/files
hi
I am not sure this is a unix question but here goes: lets say I have 2 folders "folder1" and "folder2" they are accessed via web as so: http://mydomain.com/folder1/ http://mydomain.com/folder2/ they both have an index.html file. I want everybody that tries to access http://mydomain.com/folder1/ to be redirected to: http://mydomain.com/folder2/ how do I do it without using hard link like Code:
ln folder2 folder1 I tried to use symbolic link as so: Code:
ln -s folder2 folder1 Code:
ln -s folder2/index.html folder1/index.html what other options do I have in linux/unix? thanks |
Well, if you want to redirect an html page to another html page, then add this to the source code:
Code:
<html> J_K9 |
thanks but things like that I know how to do.
I need to do something on the server side and without editing the index.html files. |
If you want people going to folder1 to go to folder2, then it doesn't make sense for folder1 to actually exist, does it? So to allow you to create a symbolic link called folder1, the existing folder called folder1 must be deleted or moved away.
mv folder1 folder1.bak ln -s folder2 folder1 |
Quote:
after a while I will un-redirect it |
The best way to do that is to configure Apache (or whatever your server is) to do the redirection.
The next best solution is to do this with PHP (for example), hence on the server side, by creating a folder1/index.php file, whose content is something like: Else, there's Javascript as the previously mentionned fallback solution. Yves. |
make a .htaccess file and
insert following code to it Redirect /folder1/index.html http://yourdomain.com/folder2/ save it as .htaccess and put it in folder1, this will redirect all the requests to folder2 |
Quote:
|
Hmm...
Redirecting means telling the browser he should go to some other place than the one he is currently looking at. Key words here are "telling the browser". Telling the browser something can be done by javascript or php or .htaccess or whatever your server supports (which one do you have, anyway?) By creating symbolic links, you will never be able to tell the browser anything. It's just fundamentally impossible. All you can achieve by using symbolic links is telling the server (keyword: "server") that it should feed to the browser a file that is not in the current directory, but somewhere else. The browser, however, will never notice this. As far as it knows, the file it is getting is located at the 'old' location. So in summary, these are fundamentally different things. You must decide which one best suits your needs. Groetjes, Kees-Jan |
I thinki your question is
Quote:
Quote:
|
All times are GMT -5. The time now is 03:35 AM. |