Problem with symlink url


#1

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


#2

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.


#3

Make sure your symlink target has a trailing slash:

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

If you want useful replies, ask smart questions.


#4

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.


#5

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


If you want useful replies, ask smart questions.


#6

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.


#7

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


#8

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?