LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 06:54 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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, 12: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, 01:12 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
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, 01: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, 02:05 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

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


Reply



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 10:02 PM
need help resolving error message with ndiswrapper when configuring linksys WPC54G izquierdista Linux - Wireless Networking 8 09-20-2005 03:05 PM
Apache won't start, but doesn't give error message escargot22026 Linux - Software 1 08-10-2004 09:34 PM
Webmin Apache error message BrettPower Linux - Software 17 03-11-2004 11:02 PM
Apache webserver error message dienerk Mandriva 1 02-24-2004 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05: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
Open Source Consulting | Domain Registration