Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-10-2008, 02:35 PM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default Zend Framework, URI rewriting, & Netfirms Web Hosting

I've written a very simple CMS atop Zend Framework, and it functions as expected on my local setup (Ubuntu Gutsy's Apache and PHP5 packages).

However, when uploaded to Netfirms, URI routing ceases to function as expected.

A few code examples to outline what I'm doing:

relevant bootstrap file excerpt

Code:
// set up & run the front controller
$front = Zend_Controller_Front::getInstance();

// set custom routing rules
// @todo: define via XML
$router = $front->getRouter();
$route = new Zend_Controller_Router_Route('/:category/:seoId/*', array('controller' => 'page', 'action' => 'view', 'category' => null, 'seoId' => null));
// @todo: use regex to verify that seoId is proper format
// @todo: figure out how to throw a 404
$router->addRoute('viewPage', $route);

$front->throwExceptions(true)
	  ->setControllerDirectory('./application/controllers')
	  ->dispatch();
relevant controller excerpt

Code:
	function viewAction()
	{
		$content = new PageModel;
		$page = $content->getPage($this->_request->getParam('category'), $this->_request->getParam('seoId'));
		
		$this->view->title = $page->pageTitle;
		$this->view->description = $page->pageDescription;
		$this->view->content = $page->pageContent;
	}
On my local setup, this works fine (if I navigate to, say, http://localhost/appname/team/members/, "team" is returned by the first getParam() and "members" by the second).

However, on Netfirms, both calls to getParam() return "index.php".

I found a support ticket for CakePHP that might outline a similar problem, but I'm not sure (and, contradictory to what is stated in that ticket, Netfirms does support mod_rewrite). My phpinfo() on Netfirms may be of use for investigation as well, as I believe it may be an issue with funky environment variables -- I've previously had issues with other PHP apps due to Netfirms's PHP install giving funky values to various $_SERVER variables.

Can anyone please guide me from here?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-14-2008, 01:47 AM
Junior Member
 
Join Date: Mar 2008
Posts: 3
Default

The problem was that for some reason or another, Netfirms's PHP install incorrectly reports the REQUEST_URI, giving it the value of SCRIPT_NAME.

Something of a workaround may be found on the following page: How do I create search engine safe URLs in Wordpress? .: Netfirms 24/7 Support

P.S. If anyone is thinking of buying hosting from Netfirms, for goodness sake, don't do it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:06 AM.