1

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?

2
  • 1
    Add RewriteRule ^prolink.php$ /public/prolink.php above the other lines. Commented Jun 13, 2012 at 16:11
  • RewriteRule is fine, but I accomplished it with RewriteCond %{REQUEST_FILENAME} !-f Commented Jun 15, 2012 at 11:58

2 Answers 2

1
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.

Sign up to request clarification or add additional context in comments.

1 Comment

Nice work. (You'll probably want to add that -f condition to the second rule too.)
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.