如何用wordpress运行zf2 ..?

时间:2015-01-30 11:14:19

标签: wordpress zend-framework2

我用wordpress安装了zf2。现在wordpress工作正常,但当我尝试访问puclic / index.php时,它显示内部服务器错误。下面是公共文件夹中的.htaccess:

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}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 600
php_value max_input_time 600

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:4)

您可以将所有wordpress文件移动到特定文件夹,就像我在我的页面文件夹中所做的那样,并更新ZF2 base htaccess,如下所示:

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]
RewriteRule ^$ http://example.com/pages [R=301,L]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]