0

i need to figure out how i can execute the index.php on webspace root.

I have this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ /index.php [L]

Now i have a folder root/some/projects In projects are some php logics.

I wana browse to www.domain.de/some and i get a Error:

Forbidden

You don't have permission to access /some/ on this server.

Because in root/some is no php logic in. So i want that he executes the root/index.php coz there is a cms with the right content for www.domain.de/some and not the root/some/index.php

anyone have a solution?

Thx

Wykk
  • 812
  • 6
  • 12

1 Answers1

0

Somewhere in your web server configuration, there is an Options directive, forbidding any access to directories, e.g.

Options -Indexes

In your .htaccess, you explicitly say don't rewrite for existing directories, see RewriteCond Directive

  1. You can perform various file attribute tests:
    • '-d' (is directory)
      Treats the TestString as a pathname and tests whether or not it exists, and is a directory.
RewriteCond %{REQUEST_FILENAME} !-d

If you remove this condition, the rule will work for directories too.


P.S., you don't need

RewriteCond %{REQUEST_URI} !=/favicon.ico

because you already prevent the rule for existing files

RewriteCond %{REQUEST_FILENAME} !-f
Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198
  • There is no "Options -Indexs" in my .htaccess. If i remove "RewriteCond %{REQUEST_FILENAME} !-d" i have same forbidden error – Wykk Oct 01 '15 at 08:08
  • The `Options -Indexes` need not be in your .htaccess file. It could be in your main or virtual host configuration or another .htaccess up in the filesystem. – Olaf Dietsche Oct 01 '15 at 09:49
  • Have you enabled rewrite, e.g. `RewriteEngine on`? – Olaf Dietsche Oct 01 '15 at 09:50
  • Yes i have enabled rewrite. I dont find a options-Indexes entity in all my files. – Wykk Oct 01 '15 at 11:13
  • If you don't have any `Options` directive, the default takes over, which is [`Options FollowSymlinks`](http://httpd.apache.org/docs/current/mod/core.html#options). Another reason could be `Order/Deny` directive or `Require`, if you use Apache 2.4. See also http://stackoverflow.com/q/21551840/1741542 or http://stackoverflow.com/a/13258044/1741542 – Olaf Dietsche Oct 01 '15 at 12:00