Friendly URLs in phalcon framwork is not working in Ubuntu [closed]

瘦欲@ 提交于 2019-11-30 20:02:17

问题


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>

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/24049941/friendly-urls-in-phalcon-framwork-is-not-working-in-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!