hubert
hubert

Reputation: 273

symfony routing problems

I'm building a site using symfony php framework.

I have a link in my page which leads to page X :

<a href="/X">test</a>

well, the problem is, under my development environment, the link works and the link points to

http://localhost/web/frontend_dev.php/X

but when Im using the production page (index.php) the link turns out to point to :

http://localhost/web/X

when it should point to :

http://localhost/index.php/X

any ideas what the problem is ?

thanks!

Upvotes: 0

Views: 305

Answers (1)

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29965

Every link in symfony template should be generated by helper link_to() or url_for(): http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer

frontend_dev.php - is a development version of the front controller. If you are accessing a page via this controller (http://localhost/frontend_dev.php/testmodule/testaction), all links will be processed by this controller. If you will call your site via production controller (index.php, the default one), all links will point via it: (http://localhost/testmodule/testaction): http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer

Also, you have incorrect site layout. You shouldn't have any "web" subfolder in the site. Symfony libraries should be put into non-accessible area by browser. You should reread symfony documentation once more. And study this learning-project: http://www.symfony-project.org/jobeet/1_2/Doctrine/en/

Upvotes: 1

Related Questions