# [SOLVED] Apache Trailing Slash Problem (FDQN config help...)

## ZHQ

Hello!

I'm setting up a LAMP server with Gentoo and I've just noticed some differences in behavior from my old configuration (Ubuntu).

When I type in a path on my server to show a directory, I need to append a '/' on the end or else Firefox (3) will give me a "Problem loading page/Firefox can't establish a connection to the server at localhost" error.

eg) "http://ipv4:port/Path_to/Dir" must be "http://ipv4:port/Path_to/Dir/"

I'm pretty sure that the problem is just something I neglected to configure in apache (2.2). Does anyone know of a way so that one can leave out the slash and still get the directory listing?

Thanks in advance! (I can't wait until this is fully functional.  :Razz: )Last edited by ZHQ on Fri Jan 01, 2010 10:03 pm; edited 2 times in total

----------

## ZHQ

Heh, it's me again. (Happy New Year!)

I've redoubled my searching efforts and I found that this problem is called the "Trailing Slash Problem". From what I know, it's caused when someone types in a url that doesn't end in a slash and the server automatically redirects the user to the same url with the slash appended. The new url will be incorrect because the server has an incorrectly configured FQDN (Fully Qualified Domain Name). I've renamed the subject to reflect that.[/code]

So it seems that (at least for now) my problem actually lies in the network configuration. I've always had trouble with the FQDN, especially with Ubuntu. A lot of places assume you already know the FQDN and tell you where to write it in (but not what to write or how to find out what to write). This is worse when you don't have your own domain name... It's finally caught up to me! T_T

From what I know so far, the hostname should be your ip address aliased to whatever you want in the /etc/hosts file and the domain name should be whatever your isp has (find this out with a nslookup query?)

After some searching, this what I have:

```

#/etc/hosts

...

# IPv4 and IPv6 localhost alias

127.0.0.1           localhost

::1                    localhost

ipv4                  ipv4 localhost ZHQServer

...

```

Could someone make sure this is correct?

I've gotten this: "A DNS reverse lookup shows your hostname as  ip[ipv4].somewhere.domain.com." from the bottom of this page: http://www.kloth.net/services/nslookup.php

I've copied the information into /etc/hosts from the above page. I just have a question about the "ip" part. I'm not sure if it's just the page's quirky formatting or if it's actually part of the hostname...

Thanks again!Last edited by ZHQ on Fri Jan 01, 2010 10:04 pm; edited 1 time in total

----------

## ZHQ

I figured out a solution!

I have my server listening to a non-standard (ie, not port 80) port so I need to include that in my host name.

My actual configuration is this:

hostname: ipv4:port

dnsdomainname: somewhere.domain.com

so in /etc/apache2/vhosts.d/00_default_vhosts.conf

after ServerName I put:

ServerName ipv4:port.somewhere.domain.com

This fixes the trailing slash problem. However, I feel that this still seems a little clunky. It seems like I can put an alias like "ZHQServer" after ServerName and then have /etc/hosts or /etc/conf.d/net or something contain ipv4:port.somewhere.domain.com so the server can just replace it when needed...

Anyway, I hope this helps someone!

----------

## Mistwolf

 *Quote:*   

> I've gotten this: "A DNS reverse lookup shows your hostname as ip68-9-244-200.ri.ri.cox.net." from the bottom of this page: http://www.kloth.net/services/nslookup.php
> 
> I've copied the information into /etc/hosts from the above page. I just have a question about the "ip" part. I'm not sure if it's just the page's quirky formatting or if it's actually part of the hostname... 

 

your Cox' hostname is ip68-9-244-200.ri.ri.cox.net (yes, the ip IS part of the hostname).  Just remember, if you are not on a static IP, your hostname will change when your external IP address changes (right now, based on your hostname, your external IP is 68.9.244.200).

With regards to setting up a FQDN, checkout http://www.gentoo-wiki.info/FQDN for a very basic guide.

----------

## ZHQ

Ah. Thanks. It seems more helpful now that I've read up on it...   :Embarassed: 

----------

## Mad Merlin

You can assign your own FQDN if you only care to access your server from machines you control. Either add your arbitrary entry to /etc/hosts on each applicable machine, or run your own local DNS server which serves said arbitrary DNS entries (if you use a router with something like Tomato, you can do this automagically with static DHCP leases). So, if your arbitrary FQDN is a.b.c, then put a.b.c in for ServerName in your Apache config and problem solved.

The only difference between "having your own domain" and making one up is in the former case, everyone can resolve that domain, in the latter case, only you can.

Edit: Furthermore, any particular machine can have an arbitrary number of FQDNs, not just one.

----------

