silex framework和.htaccess,获取错误403禁止访问
我决定证明silex框架。我将index.php文件、.htaccess和库silex.phar放在我称为“prova”的同一目录中 但是,当我在浏览器中访问url“localhost/~username/prova”时,我得到错误403禁止访问 我的错误是什么 下面是我在应用程序中使用的代码 index.php文件silex framework和.htaccess,获取错误403禁止访问,.htaccess,silex,.htaccess,Silex,我决定证明silex框架。我将index.php文件、.htaccess和库silex.phar放在我称为“prova”的同一目录中 但是,当我在浏览器中访问url“localhost/~username/prova”时,我得到错误403禁止访问 我的错误是什么 下面是我在应用程序中使用的代码 index.php文件 如果您的应用程序正在/~username/prova中运行,那么我怀疑您需要设置: RewriteBase /~username/prova/ 如果您的应用程序运行在/~user
如果您的应用程序正在/~username/prova中运行,那么我怀疑您需要设置:
RewriteBase /~username/prova/
如果您的应用程序运行在/~username/prova中,我怀疑您需要设置:
RewriteBase /~username/prova/
虽然有点晚,但在index.php在我的测试环境中起作用之前删除斜杠。
这将在.htaccess中留下以下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php[QSA,L]
虽然有点晚,但在index.php之前删除斜杠在我的测试环境中起作用。
这将在.htaccess中留下以下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php[QSA,L]
index.php的完整路径是什么?在计算机上,而不是通过浏览器。my index.php的完整路径是/Users/username/Sites/prova
检查apache错误日志。通常在/var/log/apache2/error.log
中。日志文件的输出:选项FollowSymLinks或SymlinksFownerMatch关闭,这意味着禁止重写规则指令:/Users/username/Sites/prova//code>@reb2awrl请将您的解决方案作为答案编写,并作为正确答案接受。index.php的完整路径是什么?在计算机上,而不是通过浏览器。my index.php的完整路径是/Users/username/Sites/prova
检查apache错误日志。通常在/var/log/apache2/error.log
中。日志文件的输出:选项后面的symlinks或symlinksFownerMatch处于关闭状态,这意味着禁止重写规则指令:/Users/username/Sites/prova/
@reb2awrl请将您的解决方案作为答案编写,并作为正确答案接受。