gpt4 book ai didi

php - Symfony2 : 404 Not Found without app. php

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:38:16 25 4
gpt4 key购买 nike

这是我在 public_html 目录中的 htaccess :

DirectoryIndex app.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>

这是/etc/apache2/sites-available/mydomain_com.conf :

<VirtualHost *>
ServerAdmin webmaster@mydomain.com
ServerName mydomain.com
ServerAlias www.mydomain.com

# Indexes + Directory Root.
DocumentRoot /home/myuser/domains/mydomain.com/public_html
# DirectoryIndex app.php
<Directory /home/myuser/domains/mydomain.com/public_html>
AllowOverride All
Order allow,deny
Allow from All
</Directory>

# CGI Directory
ScriptAlias /cgi-bin/ /home/myuser/domains/mydomain.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>


# Logfiles
ErrorLog /home/myuser/domains/mydomain.com/log/error.log
CustomLog /home/myuser/domains/mydomain.com/log/access.log combined
</VirtualHost>

这些是结果:

  • mydomain.com => 重定向到 mydomain.com/app.php/ 然后工作正常。
  • mydomain.com/post/ => 404 未找到
  • mydomain.com/app.php/post/ => 工作正常。

有什么想法吗?

最佳答案

是否开启了apache的mod_rewrite?如果没有,启用它,重新启动服务器并重试。

a2enmod rewrite
service apache2 restart

关于php - Symfony2 : 404 Not Found without app. php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29874542/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com