Problem with symlink url

Problem with symlink url

Posted by: juminoz
Posted on: 2006-03-29 19:29:00

I'm currently hosting a rail application in a subdomain. I was told that it's not supposed to work, but it's except that I have to put a "/" at the end of url to make it work:

web.com/app/ <-- will work
web.com/app <-- give me a bad request error

Is there a way to fix this? "app" is basically a symlink which points to the public directory of the application.

Thanks

Re: Problem with symlink url

Posted by: guice
Posted on: 2006-03-30 12:09:00

Do you have an .htaccess file which does some kind of behind the scene rewrite?

By default, Apache will add the / to directories, even symlinked ones, however, if you have a .htaccess file altering what web.com/ will do, then it won't work.

Re: Problem with symlink url

Posted by: kchrist
Posted on: 2006-03-30 13:16:00

Make sure your symlink target has a trailing slash:

ln -s /path/to/target/directory/ symlink_name

Re: Problem with symlink url

Posted by: juminoz
Posted on: 2006-03-30 13:21:00

This is what I did to create the symlink

ln -s /path/to/target/directory/ symlink_name

So I don't think that was the problem. As for the .htaccess, I don't think I did anything to it. I'll look into it though.

Re: Problem with symlink url

Posted by: kchrist
Posted on: 2006-03-30 14:16:00

What does your error log say?
(/home/username/logs/example.org/http/error.log)

Re: Problem with symlink url

Posted by: juminoz
Posted on: 2006-03-30 21:48:00

There's nothing in the log file that is useful. I also checked the .htaccess file and restored it to the initial state.

I think the issue might be the fact that the symlink name is different from the application name. I couldn't create a symlink with the same name because it didn't let me. So if the name of the application is "app" then the symlink is "apps". If I just type in web.com/app, it would not direct to the public directory, but gives me a list of directory instead.

Any suggestion? BTW, this is an application in a subdomain, not subdirectory.

Thanks.

Re: Problem with symlink url

Posted by: dtobias
Posted on: 2006-04-05 17:44:00

Your example URLs shown in your first post didn't have any subdomain in them. A subdomain is something like sub.example.net, which is a subdomain of example.net. A subdirectory is like example.net/dir/. A subdirectory in a subdomain would be like sub.example.net/dir/. It's always a good idea to include the trailing slash when citing a subdirectory URL, to avoid an unnecessary server redirect.

-- Dan

Re: Problem with symlink url

Posted by: juminoz
Posted on: 2006-04-09 20:19:00

It's definitely a subdomain. I just didn't type everything in the post. I still haven't figured out a way to fix it after trying so many things. I'm still getting "Bad Request Error" every times if I don't explicitly type "/" at the end.

Any other ideas?

Tags: urlsymlinksubdomainhosting