Wojciechk
Wojciechk

Reputation: 99

zend htaccess public php file

is there any way to access e.g. prolink.php file in zend /public directory by typing mydomain.com/prolink.php, and go to application in other cases (index.php)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L] 

should I specify a route for that?

Upvotes: 1

Views: 1339

Answers (2)

Bart
Bart

Reputation: 505

put index.php file into the public folder and put .htaccess in the root folder, witch contents

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]

Options -Indexes

Upvotes: 0

Wojciechk
Wojciechk

Reputation: 99

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^prolink.php$ public/prolink.php

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f If the request is for a file that exists already on the server, index.php isn't served.

Upvotes: 1

Related Questions