I’m new to Phalcon and I like the framework but I have problems with links. I use phalcon version 0.6.1 and XAMPP 1.8.1 that has vhosts set to xampp/htdocs/test where my phalcon test is.
I have been following the tutorial and came to a problem. When I use links to load other controllers the adress bar shows the correct path but as far as I can see the index.phtml get loaded every time. I uploaded the files here so you can see for yourselves.
It doesn’t matter if I use Tag::LinkTo() or since it doesn’t change.
edit:
I followed the instructions, removed the .htaccess files from the /test and /test/public directories to move the to httpd.conf. At the end of it I added
<Directory "C:/xampp/htdocs/www/test"> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </Directory> <Directory "C:/xampp/htdocs/www/test/public"> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] </Directory>
and modified my httpd-vhosts.conf like this
ServerAdmin admin@example.host DocumentRoot "C:/xampp/htdocs/test/public" DirectoryIndex index.php ServerName example.host ServerAlias www.example.host <Directory "C:/xampp/htdocs/test/public"> Options All AllowOverride All Allow from all </Directory>
The page loads but the absolute links like /public/css/bootstrap.min.css don’t work and when I click the link it gives me an error 404 and says Object not found. I modified the files like this:
<Directory "C:/xampp/htdocs/test"> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </Directory> <Directory "C:/xampp/htdocs/test/public"> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] </Directory>
and
ServerAdmin admin@example.host DocumentRoot "C:/xampp/htdocs/test" DirectoryIndex index.php ServerName example.host ServerAlias www.example.host <Directory "C:/xampp/htdocs/test"> Options All AllowOverride All Allow from all </Directory>
But that brings me to my original problem that when I click the link it loads index.phtml again even though it says localhost:8005/sample in the URL.
It looks like your Apache configuration is not allowing reading the .htaccess file:
Also, at the top of your public/index.php check that $_GET[‘_url’] has the URI passed to your browser