Note that there are some explanatory texts on larger screens.

plurals
  1. PO'Server Not Found' error when using sfDomainRoutePlugin with Symfony
    text
    copied!<p>I am trying to create a site with subdomains, using the <a href="http://www.symfony-project.org/plugins/sfDomainRoutePlugin" rel="nofollow">sfDomainRoutePlugin plugin</a>. I am using SF version 1.4.12 on Linux, with Apache as the web server.</p> <p>I am following the online instructions and have created the following routing file:</p> <pre><code>homepage: url: / class: sfDomainRoute param: { module: foo, action: index } requirements: sf_host: [portal.localhost] #Sample route limited to one subdomain blog: url: / class: sfDomainRoute param: { module: foo, action: foo1 } requirements: sf_host: blog.portal.localhost #Sample route that will capture the subdomain name as a parameter user_page: url: / class: sfDomainRoute param: { module: foo, action: foo2 } #Sample route that will not receive a subdomain and will default to www.greenanysite.com install: url: /install class: sfDomainRoute param: { module: foo, action: foo3 } </code></pre> <p>My foo module code has the methods foo1, foo2 and foo3 implemented as stub functions, and each have their template which simply contains text confirming which method was executed (e.g. 'foo::Foo1 was called') etc.</p> <p>The template for the index method (in the foo module) looks like this:</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Test subdomains&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li&gt;&lt;?php echo link_to('homepage', '@homepage'); ?&gt;&lt;/li&gt; &lt;li&gt;&lt;?php echo link_to('blog', '@blog'); ?&gt;&lt;/li&gt; &lt;li&gt;&lt;?php echo link_to('zzzrbyte', '@user_page?subdomain=zzzrbyte'); ?&gt;&lt;/li&gt; &lt;li&gt;&lt;?php echo link_to('install', '@install'); ?&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The urls are generated correctly (i.e. with subdomains as specified in the routing.yml file), however when I click on the 'blog' or 'zzzrbyte' link, I get the error message: <strong>'Server Not Found'</strong></p> <p>For example, I got this message:</p> <blockquote> <p>Server not found Firefox can't find the server at blog.portal.localhost.</p> </blockquote> <p>AFAICT, I am following the online instructions exactly, so I can't see where I am going wrong. Can anyone spot what is likely to be causing this problem?.</p> <p><strong>[[UPDATE]]</strong></p> <p>I just realized that by adding the subdomain to my hosts file, this seems to get rid of the problem. I am not sure if this is the fix or simply a temporary workaround. If this is the way to do things, I wonder why such a vital piece of information was left out of the notes?</p> <p>If this is the way to get things to work, it means that subdomains will have to be known before hand (i.e. not generated dynamically and resolved at run time), also - I am not sure how such a solution works for a remote server, since I am running multiple websites (as virtual servers) on one physical machine and I am not using a hosts file on the server.</p> <p>Any help will be much appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload