# Whose fault is it

## Mallrats

when friends try to view my web site, links to http://ipaddress/subdirectory fail, but links to http://ipaddress/subdirectory/index.php work

Whose fault is this, apache or the web browser, and if it's apache's fault, how do I fix this?

I'm using Apache 2

----------

## manywele

They both seem to work for me.  But why are you advertising free cars?   :Very Happy: 

----------

## Mallrats

haha, those were just filler words, not actual links!  I didn't know that they would resolve at all!

----------

## manywele

It works for me if I use index.php.en instead of just index.php.  I looked for a while a couple of months ago trying to find where that was set in the configs but failed.  Ah well.  Learning Apache is on my List of Things To Do next year (still '03 here).

----------

## Mallrats

When the time comes, Happy New Year

By the way, 2004 is much different than 2003!

----------

## jtp755

also have a look at the DirectoryIndex line in your apache2.conf file.

----------

## manywele

 *jtp755 wrote:*   

> also have a look at the DirectoryIndex line in your apache2.conf file.

 

I don't have a DirectoryIndex line in my apache2.conf you insensitive clod!

No, really.  I don't have one.  No line containing Directory or Index and only one irrelevant instance of directory.  This is 2.0.48.  What should it contain?

----------

## elzbal

Are you sure you don't have a DirectoryIndex line? One appears (or should appear) in the file by default. If it is not there, I might be a bit worried that something else may be wrong. Do a search for "index.html" to see if you can find it.

The DirectoryIndex directive specifies a "default document" that will be served if a directory is requested. By default, the line should look like:

```
DirectoryIndex index.html
```

Change it to the following (or add the following) and all will be well:

```
DirectoryIndex index.html index.php
```

More info can be found at http://httpd.apache.org/docs-2.0/mod/mod_dir.html#directoryindex

(The same command exists for both Apache 1.3 and 2.0.)

----------

## Chris W

The DirectoryIndex directive is in commonapache2.conf for a standard Gentoo emerge of Apache2.  The default install settings are fine, and shouldn't be causing this problem.

Have you started Apache with "-D PHP4"?  See /etc/conf.d/apache2 to set/check this.

----------

## Mallrats

```
DirectoryIndex index.html index.html.var index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm
```

So it looks like DirectoryIndex is not my problem.  If so, what is?

----------

## Chris W

Did you check for "-D PHP4"?

Is this the default Apache site or have you set up your own vhost?  If so, what is the configuration?

Does "http://ipaddress/subdirectory/"  (note trailing slash) work?

Have you disabled mod_dir (responsible for rewriting "http://ipaddress/subdirectory" to "http://ipaddress/subdirectory/")?

When the "http://ipaddress/subdirectory" fails what is the error message, or do you get a directory listing?

----------

## Mallrats

I have -D PHP4 enabled (without it, php wouldn't be working)

I don't know what a vhost is, so I think it's the default Apache site.

I can't tell you right now if a trailing slash makes a difference because the problem isn't with my system, it's with others who view my web page, whether they use Mozilla or IE.  Everything, even no trailing slash, works on localhost, where the web site is being served from.

I didn't manually disable mod_dir, but where would that setting be so I can make sure?

----------

## Mallrats

Think I found where it was, in /etc/apache2/conf/apache2.conf

```
LoadModule dir_module                    modules/mod_dir.so
```

So it doesn't look like it's being disabled

----------

## Telamon

Check your apache2.conf file and see if you have a line

```
Include conf/vhosts/Vhosts.conf
```

If it's commented out (# at the start of the line), you should be fine (Apache2 will use the global configs for anyone who connects) but if it's not commented out, you might have some settings in /etc/apache2/conf/vhosts/vhosts.conf that are changing your config for people coming in under a different hostname or port.  Post the output of

```
grep -v ^# /etc/apache2/conf/vhosts/vhosts.conf
```

if there is any, and maybe we can figure it out from there.  Real example URLS might help too (just setup a test dir if you don't want people looking at the real site.)

----------

## Mallrats

Thanks for the reply

```
dave@neo dave $ grep -v ^# /etc/apache2/conf/vhosts/vhosts.conf

(No output)
```

Every line in the file is commented out

however, in my apache2.conf:

```
Include conf/vhosts/vhosts.conf
```

Is it possible this line that includes a blank file is affecting my webserver's function?

This is the default "emerge apache" configuration

----------

## Telamon

Hmm, nope, if the file is blank including it doesn't trigger anything bad.  Are you behind any sort of NAT box / firewall?  Also, from your local machine, does it work if you use your public IP address (ie, http://123.45.67.89/dir/ instead of http://locahost/dir/)?

BTW: When someone goes to http://ipaddress/subdirectory what error do you get in error_log?  

```
tail /etc/apache2/logs/error_log
```

 might give us something to go on.

----------

## Mallrats

Telamon:

I'm not behind any FireWall (that I know of), also, on my box, 123.45.67.89/dir does work.

I'll let you know about the error log when I get my tester online  :Smile: 

----------

## Mallrats

http://droberts.homelinux.org:8008/teacher

By the way, by all means look at the real site!  There's not much at all there!

I may be turning the computer on and off, but otherwise it's usually on and serving

----------

## Mallrats

Looks like somebody else [client 66.157.73.48] was able to log into my site  :Smile: 

Anyone want to stand up  :Wink: 

In other news, the log did not reveal any errors when my other friend tried going to the address with no trailing slash

----------

## Chris W

Is the PHP web-app directory in the default document root i.e. /var/www/localhost/htdocs ?

Is there a .htaccess file in /var/www/localhost/htdocs?

Is there a .htaccess file in /var/www/localhost/htdocs/subdirectory?

----------

## Mallrats

I don't know what a PHP web app directory is, and I'm pretty sure I don't have one in my DocumentRoot (no directory I can see)

There is not a .htaccess file in either directory

----------

## Chris W

The directory containing your PHP application is the one I was referring to.

----------

## Chris W

http://droberts.homelinux.org:8008/teacher/ works.

http://droberts.homelinux.org:8008/teacher/index.php works.

http://droberts.homelinux.org:8008/teacher gives me an error box indicating refusal when trying to contact 127.0.0.1:8008.  Doesn't look like the server is able to work out its name for the redirecton.  Set the ServerName parameter (/etc/apache2/conf/apache2.conf) to your fully qualified domain name.

----------

## manywele

I've been watching this thread interestedly as I have the same issue and the same default setup.  As I posted above it works if I change index.php to index.php.en.  Does this have to do with the language settings in commonapache2.conf?

----------

## Chris W

I don't think Mallrats' problem is related to language settings.  Mallrats' index.php is functioning if directly addressed.

----------

## manywele

So was mine before I changed it.  I was having the same issues.

----------

## manywele

I'm still curious.  Did you find a resolution to this problem?

----------

## Mallrats

 *Chris W wrote:*   

> Set the ServerName parameter (/etc/apache2/conf/apache2.conf) to your fully qualified domain name.

 

I have always wondered what this was and where to find it

----------

