gpt4 book ai didi

php - MVC htaccess 重写

转载 作者:可可西里 更新时间:2023-11-01 00:14:50 24 4
gpt4 key购买 nike

你好,我在我自己的 mvc 中的 htaccess 配置有问题。 IDK我做错了什么?我一直收到这条消息 500:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

我想让 url 重写为 index.html尝试做这样的事情

www.example.com/index.php/controller/method/param

www.example.com/index.php?url=controler

我的 .htaccess 看起来像这样:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+) index.php?url=$l [QSA,L]

我做错了什么??我读了http://httpd.apache.org/docs/current/rewrite/flags.html并如何解释。

最佳答案

<IfModule mod_rewrite.c>    
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteCond %{REQUEST_URI} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

这个应该可以用

http://www.mysite.com/stats

=>

http://www.mysite.com/index.php?url=stats

关于php - MVC htaccess 重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16314756/

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