LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Redirect a folder to another so I can access files (https://www.linuxquestions.org/questions/linux-newbie-8/redirect-a-folder-to-another-so-i-can-access-files-631628/)

yersin 03-29-2008 11:00 PM

Redirect a folder to another so I can access files
 
Hi.

I'm using Linux (Sme server) as a web server. By default, Sme server create s three folders for each site, and index.php and the other files and folders are inside the html folder, like this:

cgi-bin
files folder 1
html
-files folder 2
-...
-index.php

When I upload files through the website (using drupal 5.2), they get into the files folder 2, which is ok, however, when I try to download the uploaded files, I get an error, because the files are looked for in the files folder 1 outside folder html; however, if I copy the uploaded files from 2 to 1, I can download normally.

I think the problem occurs because files are looked into nameofwebsite.com/files, and thus files folder 1.

So, how can I have a folder redirected to another? Is there a way to create something like a link so that when files are looked for in folder 1, files from the folder 2 are taken?

esaym 03-30-2008 02:04 AM

sounds like a drupal problem to me

but you might just be able to use a symbolic link:

ln -s /directory/source /directory/target

If I understand correctly you have 4 folders under each website directory?

So an example should be something like

ln -s /home/website/folder2 /home/website/folder1/folder2

Then folder1 will have a "shortcut" to folder2 in it.

fotoguy 03-30-2008 07:39 PM

It could also be the apache httpd.conf file for the webserver is not let you go out the root directory, or follow symlinks. If there is no entry in the httpd.conf file for folder 1 it wont let you in there as well, could you post the contents of the https.conf for us too see, this will make it a bit easier to help trouble shoot.

yersin 03-30-2008 11:31 PM

kind of solved
 
Thanks for answering.

First, I haven't been able to create a symbolic link. Being in root, I tried:

#ln -s ./html/files files

That created a link inside the existing folder (1) targeting at the files folder (2) inside html. It didn't solved the problem. It seems that I can't create a link named files if there's already a folder with that name. It looke like: root/files/files, and it can't be accessed. Then, I deleted the files folder 1 and the link just created, and I tried again:

#ln -s ./html/files files

Apparently it did it. It takes me to folder 2. However, when I try to download files, I get a "403 Forbidden error", although before I was able to access to files outside html. Besides, if I had just deleted the files folder 1, (without making the link), I would've gotten the same error. Apparently, without the files folder 1, files folder 2 is looked for.

Next, I created another folder inside html and named it "uploaded", and configured drupal to upload files into this folder. That did it. It seems that drupal got confused with files folder 1, because SME server by default takes root/files to the folder outside html. I hope I won't have more problems; otherwise, I'll come back.

So far I know, I can't change conf files manually with Smer server.

Yersin.


All times are GMT -5. The time now is 09:34 PM.