Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess将子文件夹重定向到带有变量的索引_.htaccess_Redirect - Fatal编程技术网

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

.htaccess htaccess将子文件夹重定向到带有变量的索引,.htaccess,redirect,.htaccess,Redirect,我正在尝试使用htaccess重定向用户。我想将任何通配符子文件夹重定向到以子文件夹作为php变量的索引 例如: http://domain.com/abc 改为: http://domain.com/index.php?x=abc 我很确定我能做到这一点,尽管我不是100%。谢谢 这应该很容易,使用以下代码: Options +FollowSymlinks RewriteEngine On RewriteRule ^abc /kat.php?index.php?x=abc [L] ##

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

例如:

http://domain.com/abc
改为:

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

我很确定我能做到这一点,尽管我不是100%。谢谢

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

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^abc /kat.php?index.php?x=abc [L]

############ or dynamic

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^(.+) /kat.php?index.php?x=$1 [L]
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /

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

我正是想这么做,但对我不起作用。谢谢你的回答!绝对完美。非常感谢您抽出时间回答!