Tutorial :symfony routing problems with index.php



Question:

I have a site built in symfony.

However, I'm putting some routing rules :

resgister:  url:     /register  param:   { module: register, action: index }  

and I put a link :

link_to('register - here','register')  

but this link points to http://www.mydomain.com/register instead of http://www.mydomain.com/index.php/register

so I get an 404 error.

this problem occours only on production env, and not on development env.

any ideas ?

thanks!


Solution:1

Because no_script_name setting is set to "on" in production env.


Solution:2

There's a misspelling in your YML file:

resgister:    url:     /register    param:   { module: register, action: index }  

should be

register:    url:     /register    param:   { module: register, action: index }  

Use with:

echo link_to('register - here','@register');  

This should fix the 404. The no_script_name is the reasons you don't see index.php as stated in several other answers.


Solution:3

You have to uncomment this line RewriteBase / in your /web/.htaccess file

# uncomment the following line, if you are having trouble  # getting no_script_name to work  #RewriteBase /  

That will probably help :)

I assume you have the apache rewrite_module enabled


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »