LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2005, 07:41 AM   #1
haora
Member
 
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69

Rep: Reputation: 15
configuring apache 2.0 to give a custom error message


Hi all..., I'm trying to configure my apache so, that when I want acces a directory it will call a php script, that after checking the ip of the visitor will show the content of that directory....

But I don't know wich configuration file to change...., and what to put in it....

Any ideas???

Thanks in advance..
 
Old 03-10-2005, 07:54 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
So long as the name of the script is listed in DirectoryIndex before any other filename in the directory it will be picked up first. You can then get your php script to check the IP and generate a directory listing.

Depending on what you are trying to acheive you may be able to use the Allow directives and apache's inbuilt directory listings.
 
Old 03-10-2005, 01:13 PM   #3
haora
Member
 
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69

Original Poster
Rep: Reputation: 15
What I'm trying to do is simple, I want my self, and a few co-workers to see the directory listing of any directory in my machine....(I do this with a php script), the thing is, I don't know how to tell apache to run that script when someone is trying to acces a directory in my machine....

The best I could do was put an "index.php" file in "/" but it only works when you access that directory...

Can you tell me how to configure apache to do what I want?

Thanks!
 
Old 03-10-2005, 02:12 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Ah, so you want it to be accessed for every directory.

The simplest thing to do would be create an apache rewrite url
RewriteRule ^(.*)$ /myscript.php?path=$1 [L]

Then just evaluate $_GET["path"].
 
Old 03-10-2005, 02:46 PM   #5
haora
Member
 
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69

Original Poster
Rep: Reputation: 15
Ok, remember I'm in the newbie forum..., which means..., I have no idea about what you just said....
I need a little more...., like what files to change..., what do I do to that file?, just write that in?, where?

Thanks!
 
Old 03-10-2005, 03:05 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
The rewrite rule will need to be added to the <Directory> directive for your DocumentRoot in httpd.conf.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ZipSlack 10 + LOADLIN give error message(s) --INIT: Cannot execute "/sbin/agetty"-- dhv Slackware 9 07-24-2006 11:02 PM
need help resolving error message with ndiswrapper when configuring linksys WPC54G izquierdista Linux - Wireless Networking 8 09-20-2005 04:05 PM
Apache won't start, but doesn't give error message escargot22026 Linux - Software 1 08-10-2004 10:34 PM
Webmin Apache error message BrettPower Linux - Software 17 03-12-2004 12:02 AM
Apache webserver error message dienerk Mandriva 1 02-24-2004 02:15 PM


All times are GMT -5. The time now is 04:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration