Why do you think you have to use setBaseUrl()? There is no need to.

You have to use setBaseUrl() if your url looks like this:
http://tauren.dev/something/anything/news/show

By default Zend_Controller_Front will use "something" as your controller, 
"anything" as your action and "news=show" as request param. After setting the 
base url to "/something/anything/" your Front Controller will use "news" as 
your controller and "show" as your action.

So I think you do not need to set an base url.

-- Jan


-----Original Message-----
From: novastorm [mailto:jonyn...@gmail.com]
Sent: Mon 12/15/2008 6:19 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Why isn't this working?
 

Hello,
I'm using the ZF to build an application. I have encountered
a problem that I just don't understand. I can't get hold of the 
host url with the setBaseUrl() method from Zend_Controller_Front.
Subsequently, all my links, that are made dynamically
with smarty, don't work, because they turn out like
http://index instead of http://project.dev/index.

But if I for instance do this:

    $controller = Zend_Controller_Front::getInstance();
    $controller->setBaseUrl('../');

.. all my url's look fine, but I get a 404 error when I click them.

My apache folder structure is like this (it's on windows btw):

/www (webroot for virtual host "localhost")
/www/Tauren/htdocs (webroot for virtual host "tauren.dev")

in /www/Tauren/ I have a httpd.conf file with the virtual host config:

<VirtualHost *:80>
    ServerName tauren.dev
    ServerAlias tauren.dev
    DocumentRoot "D:\wamp\www\Tauren\htdocs"

    <Directory "D:\wamp\www\Tauren\htdocs">
        AllowOverride All
        Options All     
    </Directory>

    php_value include_path
".;d:\wamp\www\Tauren\include\Zend\library;D:\wamp\www\Tauren\include;D:\wamp\bin\php\php5.2.6\PEAR"
    php_value magic_quotes_gpc off
    php_value register_globals off

    SetEnv APP_CONFIG_FILE "settings.ini"
    SetEnv APP_CONFIG_SECTION "development"

</VirtualHost>

and in /www/Tauren/htdocs I have a htaccess file with the rewrite rule:

RewriteEngine On                                                
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

Hopefully, some of this information might shed light on things. I'll supply
more information on demand. Any feedback and suggestions are welcome at this
point :-)
-- 
View this message in context: 
http://www.nabble.com/Why-isn%27t-this-working--tp21017887p21017887.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to