Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework General discussions > Installation & Configuration

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-2008, 02:26 PM
Junior Member
 
Join Date: Aug 2008
Posts: 4
Default Confused about base URL...

I'm new to ZF, and I'm working on a project where we have a deployable application. In most cases the application will live in a document root (http://host/index.php), and I understand that part of it.

But we are contemplating what would happen if a user tried to install in a subdirectory, such as http://host/username/index.php

It seems to me that if I set the RewriteBase to /username, then ZF will automatically rewrite all of the URLs in the application; for example, if I link to /controller/action in this example, ZF will rewrite that link to /username/controller/action. Is that correct?

Assuming the above is correct, then here's my question: How do I handle links to non-script files? Assume that I'm using a rewrite rule like this:

Code:
Alias /username /path/to/my/doc/root
RewriteEngine on
RewriteBase /username
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
If I have a page that links to /styles/main.css, ZF will not process that request because Apache won't rewrite the request to the front controller. What's the solution here?

Hopefully this is clear... we're having a debate among our developers how best to handle this. Some are convinced that ZF's native handling will work fine, and others are convinced that we need to prepend the base URL to every link that we create (which means modifying thousands of lines of code). I'm a ZF newbie so I have no idea but I'm trying to research it.

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-04-2008, 05:00 PM
jcarouth's Avatar
Junior Member
 
Join Date: Sep 2007
Location: College Station, TX
Posts: 6
Send a message via Yahoo to jcarouth
Default

You don't have to prepend the base URL to your links because apache will handle the request as it would if you had a static site in that directory (or alias as it may be). The RewriteBase only comes into play because the alias you are using does not correspond to a physical path on the server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-01-2009, 04:47 AM
Junior Member
 
Join Date: Jun 2009
Posts: 1
Default

The way I am currently rerouting image paths for my view files are

echo "<img src='" . $this->baseUrl() . "/images/funnyforum.jpg'/>";

where baseURL is

class Zend_View_Helper_BaseUrl
{
function baseUrl()
{
$fc = Zend_Controller_Front::getInstance();
return $fc->getBaseUrl();
}
}

do you know if this is the best way to do this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB 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 07:35 PM.


Designed by: Miner Skinz Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0