symfony routing problems with index.php
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.p开发者_Python百科hp/register
so I get an 404 error.
this problem occours only on production env, and not on development env.
any ideas ?
thanks!
Because no_script_name
setting is set to "on" in production env.
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.
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
精彩评论