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 - Fatal编程技术网

.htaccess 要重定向的访问规则?

.htaccess 要重定向的访问规则?,.htaccess,.htaccess,我有一个类似于www.example.com/hello-1/hey-2的链接,现在我想做的是从www.example.com/hello-1/hey重定向到此链接。如何为此编写htaccess规则。我尝试过搜索它,尝试过同样的方法来减少index.php,但是没有成功。谢谢 看,基本上我希望人们在键入www.example.com/hello-1/hey这是我的旧链接时被重定向。我希望它们被重定向到www.example.com/hello-1/hey-2,在这里2很重要,因为它为我传递了一个

我有一个类似于
www.example.com/hello-1/hey-2
的链接,现在我想做的是从
www.example.com/hello-1/hey
重定向到此链接。如何为此编写htaccess规则。我尝试过搜索它,尝试过同样的方法来减少index.php,但是没有成功。谢谢


看,基本上我希望人们在键入www.example.com/hello-1/hey这是我的旧链接时被重定向。我希望它们被重定向到www.example.com/hello-1/hey-2,在这里2很重要,因为它为我传递了一个参数。

基本上,这样做是可能的

RewriteEngine On
RewriteRule ^hello-1/hey$   hello-1/hey-2 [R=301,L]

另外,你能举个例子吗?