[英]Symfony2 with Wordpress - How to redirect to /blog subfolder with htaccess?
I have simmilar question to this one: What is the best way to implement a blog on a website that uses the Symfony framework? 我对此有一个类似的问题: 在使用Symfony框架的网站上实现博客的最佳方法是什么? , I have a website running on Symfony2 and I want to have a blog (wordpress) in /blog but I don't have access to VirtualHosts, how I can do this with htaccess?
,我有一个在Symfony2上运行的网站,并且我想在/ blog中有一个博客(wordpress),但是我没有访问VirtualHosts的权限,如何使用htaccess做到这一点?
Take a look at the accepted answer here - Symfony Ignore Directory in web/ 在此处查看已接受的答案-web /中的Symfony忽略目录
Quote: 引用:
Ok.
好。 I figured it out.
我想到了。 The .htaccess of the sub directory also needs to be modified.
子目录的.htaccess也需要修改。
In
web/.htaccess
use:在
web/.htaccess
使用:RewriteCond %{REQUEST_FILENAME} !-d
In the sub directory,
web/other_app/.htaccess
use:在子目录中,
web/other_app/.htaccess
使用:RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /other_app/index.php [QSA,L]
This will work for wordpress and most any other php app that you want to run on a symfony site, but don't want to deal with trying to hack it into the framework.
这将适用于wordpress以及您想在symfony网站上运行的大多数其他php应用程序,但不想处理试图将其入侵框架的情况。
Try like this : 尝试这样:
.....
<IfModule mod_rewrite.c>
RewriteEngine On
# wordpress rules
DirectoryIndex index.php
RewriteRule ^blog/(.*)$ blog/$1 [PT,L]
# symfony rules
DirectoryIndex app.php
.....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.