Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
Php htaccess中的重写规则重写/重定向不再存在url链接_Php_.htaccess_Mod Rewrite - Fatal编程技术网

Php htaccess中的重写规则重写/重定向不再存在url链接

Php htaccess中的重写规则重写/重定向不再存在url链接,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我有一些像 http://www.domain.com/constant-path1/variable1.htm 实际上,url应该是 http://www.domain.com/constant-path1/variable1.htm/1 如何将不存在的旧url重定向到新url以消除google爬行器错误 我写了一条这样的规则,但不起作用: RewriteRule ^constant-path1/([^.]+).htm$ http://www.domain.com/constant-pat

我有一些像

http://www.domain.com/constant-path1/variable1.htm
实际上,url应该是

http://www.domain.com/constant-path1/variable1.htm/1
如何将不存在的旧url重定向到新url以消除google爬行器错误

我写了一条这样的规则,但不起作用:

RewriteRule ^constant-path1/([^.]+).htm$ http://www.domain.com/constant-path1/$1.htm/1 [R=301,NC]

谢谢您的帮助。

这是唯一的规则还是有更多的规则?更多规则,所有其他规则都可以。请将此作为您的第一条规则。请尝试。仍然不工作您输入了哪个URL进行测试?你能打开吗http://www.domain.com/constant-path1/variable1.htm/1 好的