When I load http://localhost/test
, I get redirected to http://localhost/public/?_url=/test
Here is my Apache config. I also tested to make sure rewrite_module is loaded.
DocumentRoot "/var/www/myapp/"
<Directory "/var/www/myapp/">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I created the project using Phalcon Dev Tools phalcon project myapp
. Here are the two .htaccess files it created automatically.
cat /var/www/myapp/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
cat /var/www/myapp/public/.htaccess
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
Using Phalcon 1.2.6, Apache/2.2.24
Firstly your apache config should be something like
DocumentRoot "/var/www/myapp/public/"
<Directory "/var/www/myapp/public/">
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Secondly there should be a .htaccess file in your public directory like this one :-
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
I hope this resolves this issue.