我现在有了zend框架htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ public/index.php [NC,L]但是我不知道如何重定向所有的“链接”参数,比如js,css,img。
发布于 2012-08-22 22:32:19
这是我的.htaccess,它工作得很完美:
DirectoryIndex /public/index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^js/(.*)$ public/js/$1 [L]
RewriteRule ^img/(.*)$ public/img/$1 [L]
RewriteRule ^css/(.*)$ public/css/$1 [L]
RewriteRule ^.*$ public/index.php [NC,L]发布于 2011-02-17 23:38:40
Solution one:您的web服务器应该指向公共目录,而不是ZF项目的根目录。
解决方案2(我认为更好):您的web服务器指向ZF项目目录,甚至ZF项目在子目录中。比如http://localhost/zf-project/。
zf- .htaccess目录中的应用程序(就在公共/、应用程序/、库/...附近):
RewriteEngine On
RewriteRule ^(.*)$ public/$1?%{QUERY_STRING} [QSA,L]公共/目录中的.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]在application/configs/application.ini中设置
resources.frontController.baseUrl = "/zf-project/"https://stackoverflow.com/questions/5023643
复制相似问题