gpt4 book ai didi

windows - 用于我的脚本的通用 mod-rewrite htaccess 文件

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:04 25 4
gpt4 key购买 nike

我正在编写一个(我希望)将被广泛分发的脚本,并且我希望确保它能够开箱即用地在尽可能多的服务器上运行。

这个脚本需要一个 .htaccess 文件,但我了解到一些 htaccess 文件不是很便携。

htaccess 需要做一个简单的重定向,像这样:

http://example.com/dir/string

Redirect to...

http://example.com/dir/index.php?string

“通用”.htaccess 文件应该是什么样子才能在所有 Windows 和 Linux 服务器上运行。

最佳答案

试试这个...

RewriteEngine On
# if the file|folder exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ /$1/index.php?$2 [L,QSA]

关于windows - 用于我的脚本的通用 mod-rewrite htaccess 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1611381/

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