Friendly URLs in phalcon framwork is not working in Ubuntu [closed]
Question
I have tried these two codes. but It is not working. It need to access public folder too.
http://docs.phalconphp.com/en/latest/reference/tutorial.html
#www/tutorial/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
#www/tutorial/public/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
Solution
If mod_rewrite
is enabled, my guess is that your server isn't with the AllowOverride
option properly set...
All .htaccess files are ignored by default in apache because someone can manage to upload a .htaccess file to your server and override your server configurations. If you're sure that your server's file system is protected you can explicit in the server's configuration that your settings can be overridden by any .htaccess
file in your directories.
This is done via the AllowOverride
setting. Refer to this question to understand a bit more about this.
OTHER TIPS
in case you are on ubuntu edit the file /etc/apache2/apache2.conf (here we have an example of /var/www)
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change it to;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
then
sudo service apache2 restart