When I had these mysterious error stelling me the URL blablabla could not be 
found it was one of the following:

Either 1. "AllowOverride All" not set for the web directory
Here's correct (i.e. working) virtual host for my MacOSX with MAMP:

        Listen 8080
        NameVirtualHost 127.0.0.1:8080
        <VirtualHost 127.0.0.1:8080>
                ServerName sitename.localhost
                DocumentRoot "/Applications/MAMP/htdocs/sitename/web"
                DirectoryIndex index.php
                <Directory "/Applications/MAMP/htdocs/sitename/web">
                        AllowOverride All
                        Allow from All
                </Directory>
        </VirtualHost>

for this to work, one has to add the line

        127.0.0.1       sitename.localhost

in the /etc/hosts file.

Or 2. The required .htaccess file in the web directory had been forgotten 
(mostly wasn't copied over from the development system)
Here's a working one from one of my projects:

        Options +FollowSymLinks +ExecCGI
        
        <IfModule mod_rewrite.c>
                RewriteEngine On
                
                # uncomment the following line, if you are having trouble
                # getting no_script_name to work
                #RewriteBase /
                
                # we skip all files with .something
                #RewriteCond %{REQUEST_URI} \..+$
                #RewriteCond %{REQUEST_URI} !\.html$
                #RewriteRule .* - [L]
                
                # we check if the .html version is here (caching)
                RewriteRule ^$ index.html [QSA]
                RewriteRule ^([^.]+)$ $1.html [QSA]
                RewriteCond %{REQUEST_FILENAME} !-f
                
                # no, so we redirect to our front web controller
                RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>

I hope this helps,
Daniel

On 2009-12-03, at 3/December, 10:17 PM, Bill Berry wrote:

> Thank you, Daniel, I get it now. The url_for() function is doing its
> job right, the problem is with my apache configuration. Yes, I do have
> several virtual hosts and I do get Apache errors with these links.
> AllowOverride All is set, though.
> Anyway, I'm reading the part of the jobeet tutorial about routing now
> and I'll read more about Apache server so I can set it up correctly.
> It's maybe a little out of the range of this discussion group but if
> anybody has a suggestion, feel free to help.
> 
> Thanks again.
> Bill
> 
> On Dec 3, 5:21 pm, Daniel Lohse <[email protected]> wrote:
>> This sounds like the work of the no_script_name option and is totally  
>> ligitimate! It makes the URLs prettier but can be problematic in  
>> shared host environments where AllowOverride All is not set and the  
>> requests crash with Apache saying that the requested URL doesn't  
>> exist. You never mentioned it but is this happening for you?
>> 
>> Otherwise, I'd advise to read all the symfony documentation,  
>> especially the routing chapters. :)
>> 
>> Cheers, Daniel
>> 
>> Sent from my iPhone
>> 
>> On Dec 3, 2009, at 4:57 PM, Bill Berry <[email protected]> wrote:
>> 
>>> I forgot to mention explicitly that these faulty links are created by
>>> the function url_for(). I also tried with function link_to() and got
>>> the same result.
>> 
>>> Bill
>> 
>>> --
>> 
>>> You received this message because you are subscribed to the Google  
>>> Groups "symfony users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected]
>>> .
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/symfony-users?hl=en
>>> .
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/symfony-users?hl=en.
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.


Reply via email to