htaccess DirectoryIndex issue

htaccess DirectoryIndex issue

Post by Harry J. Johnso » Wed, 20 Sep 2000 04:00:00



.htaccess file:
DirectoryIndex public_html/index.html

It finder the folder, opens the index.html file -- but graphics and
other html-linked elements do not show up. However they are there and
properly linked!

Anyone know why?
thank you, hj

 
 
 

htaccess DirectoryIndex issue

Post by Joshua Sliv » Wed, 20 Sep 2000 04:00:00



Quote:> .htaccess file:
> DirectoryIndex public_html/index.html
> It finder the folder, opens the index.html file -- but graphics and
> other html-linked elements do not show up. However they are there and
> properly linked!

This is because the the server just sends the file without telling
the browser that the URL is different.  Then when the browser goes
to resolve relative links, it does so with the original URL as the
base.

You could have determined this yourself by looking in the error
log.

Solution: Use absolute URLs (starting with "/") in your links.

--
Joshua Slive

http://finance.commerce.ubc.ca/~slive/

 
 
 

htaccess DirectoryIndex issue

Post by Harry J. Johnso » Wed, 20 Sep 2000 04:00:00


The .htaccess file tricks the browser and makes it think that the
index.html file is in the root directory -- not the public_html
directory -- where it actually is. Thus, all of the linked elements need
to reference the public_html directory in the directory path.

Therefore, DirectoryIndex is not the solution, because you may as well
place the index.html file by itself in the root directory and reference
the main site directory in its directory paths.


> .htaccess file:
> DirectoryIndex public_html/index.html

> It finder the folder, opens the index.html file -- but graphics and
> other html-linked elements do not show up. However they are there and
> properly linked!

> Anyone know why?
> thank you, hj

 
 
 

htaccess DirectoryIndex issue

Post by Alex Brow » Sun, 24 Sep 2000 04:00:00



> You could have determined this yourself by looking in the error
> log.

Yeah, but that would be like reading a FAQ or actually using the directives
as their outlined at the Apache site.  How naive you are Joshua ;-)

Alex.

 
 
 

1. Apache CGI, .htaccess, and DirectoryIndex interaction?

In one particular directory, I wanted to restrict access to a CGI
script and at the same time have that CGI script be the directory
index.

I tried:

    <Files "index.cgi">
    AuthName webmin
    AuthType Basic
    AuthUserFile /etc/passwd.webmin

    require valid-user
    </Files>

    DirectoryIndex index.cgi

in .htaccess, but accesses to that directory without giving the name
index.cgi didn't work.  Eventually, I put

    DirectoryIndex index.html index.cgi

in one of the /etc/apache files and got it to work with the following
.htaccess (which restricts the entire directory instead, of course):

    AuthName webmin
    AuthType Basic
    AuthUserFile /etc/passwd.webmin

    require valid-user

Does anyone want to clue me in why my first attempt didn't work?  I've
got AllowOverrides All set for this directory BTW.

Thanks,

Ben.

2. can't mount a CD-R for backups

3. Netscape Server's .nsconfig and NCSA .htaccess issues

4. Add Win95 Machine to Linux Network?

5. Odd .htaccess issue

6. browsing web became very slow after IPtables firewall

7. .htaccess and session password changing issues

8. Ph Server (AKA qi)

9. Weird .htaccess issue

10. How to prevent reading of .htaccess in a .htaccess ?

11. DirectoryIndex named after directory??

12. Apache DirectoryIndex and VirtualHost problem. Plz Help!!

13. Script Alias and DirectoryIndex