How to set the document root in a shared hosting?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
krishnik
Forum Newbie
Posts: 9
Joined: Tue Dec 08, 2009 5:57 am

How to set the document root in a shared hosting?

Post by krishnik »

Hi,

I'm not sure if this right place to ask this question. Currently i'm working on a new project with Zend framework. I need to set 'public' as the root folder, I've done some research and found the its possible through httpd.conf file. But as i'm using a shared hosting i don't have access to httpd.conf file.

How can i set document root with using httpd.conf file? I tried using the .htaccess file(with some redirect rule) . Its redirecting to public folder but zend is generating some errors. I'm sure its some issues with redirect rule in the .htaccess file .Currently i'm using my localhost to test in linux env.

Here is the rewriting rule that i've used in .htaccess file

Code: Select all

 
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.*$ public/index.php [NC]
 


but when i use such a rule i'm getting following error.

Code: Select all

 
An error occurred
Page not found
Exception information:
 
Message: Invalid controller specified (test)
Stack trace:
 
#0 /opt/lampp/htdocs/test/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /opt/lampp/htdocs/test/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /opt/lampp/htdocs/test/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /opt/lampp/htdocs/test/public/index.php(34): Zend_Application->run()
#4 {main}  
 
Request Parameters:
 
array (
  'controller' => 'test',
  'action' => 'index',
  'module' => 'default',
)  
 
 
 
Post Reply