zend htaccess公共php文件

时间:2012-06-13 15:30:13

标签: zend-framework .htaccess

有没有办法访问,例如键入mydomain.com/prolink.php在zend / public目录下的prolink.php文件,在其他情况下转到应用程序(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] 

我应该为此指定路线吗?

2 个答案:

答案 0 :(得分: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 如果请求是针对服务器上已存在的文件,则不提供index.php。

答案 1 :(得分:0)

将index.php文件放入公用文件夹 并将.htaccess放在根文件夹中,女巫内容

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