I am trying to configure .htaccess
for my web site.
there are two folders in my web site 1 - app
, 2 - public
.
i want to load index.php
from public folder and restrict all direct access to app folder
the .htaccess
i am using returns result 403 Forbidden
, but if i move index.php
in root directory it is working, i just want to point that index.php
is in public
directory and send all requests there.
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public/
# Force to exclude the trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.+)/$ $1 [R=307,L]
# Restrict php files direct access
RewriteCond %{THE_REQUEST} ^.+?\ [^?]+\.php[?\ ]
RewriteRule \.php$ - [F]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [QSA,L]
</IfModule>