Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing only index.php. How?

Status
Not open for further replies.

IzK666

Programmer
Nov 7, 2010
2
ES
I'm tired to search in google about that, without finding any answer.
I'm doing a server and I want to deny all but index.php.

This is my /etc/apache2/sites-enabled/000-default (only the important things)
Code:
DocumentRoot /home/user/websrvr
<Directory />
   Options FolowSymLinks
   AllowOverride none
</Directory>
<Directory /home/user/websrvr>
   Options FollowSymLinks MultiViews
   AllowOverride none
   Order allow,deny
   allow from 127.0.0.1
   deny from all
   <Files index.php>
      order allow,deny
      allow from all
   </Files>
</Directory>

I'm testing the server inside the lan...
When I access to " all works fine.
The trouble is when I try to access to "The server doesn't redirect to index.php.

I tried to insert 'DirectoryIndex index.php', with no luck.

Can you help me?

PS: Sorry for my bad english...
 
What is the error message you see when you try the website without the index.php page? is it a 403, 500? If 500, try enabling / on the php4script as below:

Action application/php4script /

if the error message is a 403, make sure you do have the DirectoryIndex index.php listed and the webserver has been restart. Could you attach a snippet from the access log and error log when you attempt to render this page. thanks


Mike


WarpZero Technologies
 
First of ll, thank for your answer.

The error is a 403.
As I told in the first message, I tried to include the DirectoryIndex index.php, but the result is the same.
I have added this option on both directories ('/' and '/home/user/websrvr/'), only on first ('/') and only on second ('/home/user/websrvr/'). No different results.

Now, I put the access.log and error.log connecting to ' and then to 'On the first case, error 403. On the second, all runs fine...

Access log says:
Code:
192.168.1.2 - - [14/Nov/2010:15:58:06 +0100] "GET / HTTP/1.1" 403 498 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
192.168.1.2 - - [14/Nov/2010:15:58:17 +0100] "GET / HTTP/1.1" 403 498 "-" "Opera/9.80 (Windows NT 5.0; U; es-ES) Presto/2.2.15 Version/10.01"
192.168.1.2 - - [14/Nov/2010:16:01:28 +0100] "GET /index.php HTTP/1.1" 200 5517 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
192.168.1.2 - - [14/Nov/2010:16:01:41 +0100] "GET /index.php HTTP/1.1" 200 5459 "-" "Opera/9.80 (Windows NT 5.0; U; es-ES) Presto/2.2.15 Version/10.01"

Error log says:
Code:
[Sun Nov 14 15:58:03 2010] [notice] SIGHUP received. Attemting to restart
[Sun Nov 14 15:58:03 2010] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-lubuntu9.1 with Suhosin-Patch configure -- resuming normal operations
[Sun Nov 14 15:58:06 2010] [error] [client 192.168.1.2] client denied by server configuration: /home/user/websrvr/
[Sun Nov 14 15:58:17 2010] [error] [client 192.168.1.2] client denied by server configuration: /home/user/websrvr/


One more thing, this logs are with DirectoryIndex configured.
I put the code of /etc/apache2/sites-enabled/000-default:
Code:
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /home/user/websrvr
   <Directory />
      Options FolowSymLinks
      AllowOverride none
      DirectoryIndex index.php
   </Directory>
   <Directory /home/user/websrvr>
      Options FollowSymLinks MultiViews
      DirectoryIndex index.php
      AllowOverride none
      Order allow,deny
      allow from 127.0.0.1
      deny from all
      <Files index.php>
         order allow,deny
         allow from all
      </Files>
   </Directory>
[...]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top