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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-10-2005, 07:41 AM
|
#1
|
Member
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69
Rep:
|
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..
|
|
|
03-10-2005, 07:54 AM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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.
|
|
|
03-10-2005, 01:13 PM
|
#3
|
Member
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69
Original Poster
Rep:
|
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!
|
|
|
03-10-2005, 02:12 PM
|
#4
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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"].
|
|
|
03-10-2005, 02:46 PM
|
#5
|
Member
Registered: Mar 2005
Distribution: SuSE 9.1, Ubuntu 5.10
Posts: 69
Original Poster
Rep:
|
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!
|
|
|
03-10-2005, 03:05 PM
|
#6
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
The rewrite rule will need to be added to the <Directory> directive for your DocumentRoot in httpd.conf.
|
|
|
All times are GMT -5. The time now is 04:35 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|