Zend framework .htaccess:如何重定向img,js。。从/www/到/www/public/?
我现在有zend framework htaccess:Zend framework .htaccess:如何重定向img,js。。从/www/到/www/public/?,zend-framework,.htaccess,redirect,Zend Framework,.htaccess,Redirect,我现在有zend framework 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] 但我不知道如何重定向所有“链接”参数,如j
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。解决方案一: 您的web服务器应该指向public/directory,而不是ZF项目的根目录 解决方案二(我认为更好): 您的web服务器指向ZF项目目录,甚至ZF项目也位于子目录中。 喜欢 zf项目目录中的.htaccess(就在public/、application/、library/…附近): .htaccess在public/directory中:
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/"
这是我的.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]
泽布卡,非常感谢!不幸的是,他们没有足够的声誉来给人留下一些印象:(
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]