我已经尝试过这两个代码。但它不起作用。它也需要访问公共(public)文件夹。
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>
最佳答案
如果启用了 mod_rewrite
,我猜测您的服务器未正确设置 AllowOverride
选项...
默认情况下,apache 中会忽略所有 .htaccess 文件,因为有人可以设法将 .htaccess 文件上传到您的服务器并覆盖您的服务器配置。如果您确定服务器的文件系统受到保护,您可以在服务器的配置中明确指出您的设置可以被目录中的任何 .htaccess
文件覆盖。
这是通过AllowOverride
设置完成的。引用this question进一步了解这一点。
关于php - phalcon 框架中的友好 URL 在 Ubuntu 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24049941/