如何在访问文件上添加子访问路由
how to add a sub access route on the access file
我正在为我的网站使用框架 (zend 2);它使用 ht.access 将所有 URL 请求重定向到索引页面。这完全正常。
但是,我知道想在网站上添加一个 Wordpress 博客。
我不希望博客受 Zend 模块的约束,因此需要独立于站点内。这意味着它不能受 ht 访问规则的约束。
相应地,我想要所有 url 有 Blog
目录的人
i.e www.sampleSite/blog
不受任何 ht 访问规则的约束。
以下是我的HT访问规则。你会注意到所有 URL 请求都被重定向到索引页面。
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}:: ^(/.+)(.+)::$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
我现在如何从这些规则中排除博客目录
解决这个问题很简单。
public 文件夹可在框架内访问。因此,我真正需要做的就是将我的 wordpress 博客文件夹放入其中,我们就可以开始了
即
www.sampleSite/blog
我正在为我的网站使用框架 (zend 2);它使用 ht.access 将所有 URL 请求重定向到索引页面。这完全正常。
但是,我知道想在网站上添加一个 Wordpress 博客。
我不希望博客受 Zend 模块的约束,因此需要独立于站点内。这意味着它不能受 ht 访问规则的约束。
相应地,我想要所有 url 有 Blog
目录的人i.e www.sampleSite/blog
不受任何 ht 访问规则的约束。
以下是我的HT访问规则。你会注意到所有 URL 请求都被重定向到索引页面。
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}:: ^(/.+)(.+)::$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
我现在如何从这些规则中排除博客目录
解决这个问题很简单。
public 文件夹可在框架内访问。因此,我真正需要做的就是将我的 wordpress 博客文件夹放入其中,我们就可以开始了
即
www.sampleSite/blog