1

有什么方法可以通过键入 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] 

我应该为此指定一条路线吗?

4

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

于 2012-06-15T12:01:44.510 回答
0

将 index.php 文件放入 public 文件夹并将 .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
于 2012-06-16T12:23:21.797 回答