LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Apache trailing slash (https://www.linuxquestions.org/questions/linux-general-1/apache-trailing-slash-198789/)

boondock_saint 06-28-2004 03:27 PM

Apache trailing slash
 
here is my problem

if i go to myserver.com/directory/
it works
if I try myserver.com/directory
it gives me a connection refused error.

I've read through some posts and read that aliases would fix it but I don't want to create an alias for every directory on here. Someone else mentioned the Options Directive but I'm unclear as to how that should be set up to automatically attach the slash at the end?
Any help would be greatly appreciated.

Thanks,
The Boondock Saint

hw-tph 06-28-2004 06:01 PM

Welcome to LinuxQuestions! :)

The simplest way of solving this is by specifying "UseCanonicalName On" in your Apache config file. This will automatically attach the slash and Apache will be happy. Works for both Apache 1.4 and 2.0, and you can specify it in any global section of the config file (not in the <Directory> parts, etc).


Håkan

boondock_saint 06-28-2004 10:10 PM

"UseCanonicalName On" is already in the conf file. Any other suggestions?

boondock_saint 06-29-2004 02:30 PM

argh .... don't tell that no one here has a clue as to how to fix it ????

Lleb_KCir 06-29-2004 04:28 PM

i left my apache settings as default and dont have that problem so sadly i cant help much.

boondock_saint 06-29-2004 10:31 PM

so did I :(

hw-tph 06-30-2004 12:35 AM

First off make sure that you're editing the correct file. If you have one instance of Apache2 installed with the distribution and one installed from source you're likely to be editing the wrong file (and believe me, we've had those problems here :)).


Håkan

boondock_saint 06-30-2004 10:24 AM

Well I have httpd.conf and httpd2.conf the global settings you mentioned are in commonhttpd.conf

I'm not using virtual hosts and all settings are the default settings. Is there another way I could do this like having a .htaccess file in the server root that takes the request for "directory" and forwards it to "directory/"

This is driving me mad.

boondock_saint 06-30-2004 02:46 PM

ok I just noticed that if you type dogicdesign.com//myspace
(two slashes) then it auto attaches the slash at the end and loads fine.

any clues ???

pdebian 07-07-2004 03:31 PM

Re: Apache trailing slash

Got it! At least, for VirtualHost's.

First, your ServerName should be set in your global httpd.conf. As in:

Code:

ServerName  www.example.com
Second, each VirtualHost must have a ServerName specified. For example, here's my settings:

Code:

<VirtualHost 123.456.789.100>
    ServerAdmin jennifer @ example.com
    DocumentRoot /var/www/example
    ServerAlias example.com www.example.com
    ServerName example.com
</VirtualHost>

YMMV...


All times are GMT -5. The time now is 05:12 AM.