ZF2骨架子文件夹没有重复内容

时间:2013-01-21 16:05:43

标签: .htaccess mod-rewrite url-rewriting zend-framework2

正如标题所示,我有一个世界上最简单的问题:我在/ public_html / public文件夹中的example.domain上安装了我的骨架应用程序,我希望能够从{{3}访问它}。

本教程中提供的现有.htaccess文件对我没用,因为我只能请求http://example.domain/,这是重复的内容。我可以放入/ public_html和/ public_html / public中的.htaccess文件,我只需要能够从http://example.domain/public/访问/ public_html / public下的文件,如下所示:

http://example.domain/         -> /public_html/public/index.php
http://example.domain/css/*    -> /public_html/public/css/*
http://example.domain/images/* -> /public_html/public/images/*
http://example.domain/js/*     -> /public_html/public/js/*
....

我需要解决方案是基于上面提到的纯.htaccess文件,业务逻辑是多个具有不同客户的应用程序可以访问相同的zf2模块,每个应用程序都有自己的文件夹,例如:/ public_html / web ,/ public_html / admin,/ public_html / mobile。

我愿意听取您可能提出的任何工作建议,因为我已经花了一整天阅读mod_rewrite图书但没有成功

1 个答案:

答案 0 :(得分:0)

更改htaccess中的重写基础

RewriteEngine On
# redirect requests to the public directory
RewriteBase /public/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
相关问题