gpt4 book ai didi

.htaccess - htaccess 将子文件夹重定向到带有变量的索引

转载 作者:行者123 更新时间:2023-12-03 06:48:31 25 4
gpt4 key购买 nike

我正在尝试使用 htaccess 重定向用户。我想将任何通配符子文件夹重定向到索引,并将子文件夹作为 php 变量。

示例:

http://domain.com/abc

更改为:

http://domain.com/index.php?x=abc

非常确定我可以通过 htaccess 做到这一点,尽管我不是 100%。谢谢!

最佳答案

这应该很容易,使用以下代码:

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?x=$1 [L,QSA]

关于.htaccess - htaccess 将子文件夹重定向到带有变量的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9130685/

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