install WordPress with Zend, use Zend_Auth to allow view WordPress Posts

落爺英雄遲暮 提交于 2019-12-11 16:16:59

问题


This might be easy to accomplish but I stuck ...

I had this Zend application installed on http://www.example.com using Zend_Auth to identify if user can see the rest of the page. So I have code like

if (!Zend_Auth::getInstance()->hasIdentity()) {
$this->_helper->redirector('login', 'login');
}

Now I Install WordPress under http://www.example.com/blog/

And using .htaccess to allow access to the blog as below and the same time, zend application can work

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

However, I don't want anyone to see the blog, only people who login to zend be able to see it.

I am guessing the logic should be 1. put this blog under Zend directory somewhere as external application 2. Use Zend Controller to allow access to this page?

But how can I implement this ? Any help is appreciated.


回答1:


The best way of doing this is by creating a Wordpress Module,

The simples way of doing this is by modifying pulic/blog/index.php Include zend session and the code to check the auth. If auth does not exist or is invalid redirect to login.

For the rewrite you might want to redirect anything that starts with blog in the url to the wordpress index to be compatible with fancy url's.



来源:https://stackoverflow.com/questions/7356336/install-wordpress-with-zend-use-zend-auth-to-allow-view-wordpress-posts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!