Emmettoc
Emmettoc

Reputation: 137

symfony: How to fix auto-generated static file path?

I'm trying to create an app with symfony ver.1.4.11.

I created a symbolic link to the path of "web" directory.

$ ln -s /path/to/myprojectroot/web/ ~/public_html/subdir/

So my frontend app is available like the following URL:

http://mydomain.com/subdir/frontend_dev.php

And static files are also visible by inputting the following URL directly:

http://mydomain.com/subdir/images/someimage.jpg

I think this is OK.

But when I call image_tag('someimage.jpg') in template PHP files, the image path will be generated like the following and it will cause 404 Error:

http://mydomain.com/images/someimage.jpg

The image URLs of default top page are also generated like this:

http://mydomain.com/sf/sf_default/images/sfTLogo.png

not

http://mydomain.com/subdir/sf/sf_default/images/sfTLogo.png

Also the URLs by link_to() function cause the same problems.

How can I fix this?

Upvotes: 0

Views: 571

Answers (1)

Damien
Damien

Reputation: 5882

You have to tell symfony what is the directory structure.

You can follow this documentation page.

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    // ...

    $this->setWebDir($this->getRootDir().'/web/subdir');
  }
}

Upvotes: 1

Related Questions