Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.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_Apache_.htaccess - Fatal编程技术网

Php 使用.htaccess删除url段

Php 使用.htaccess删除url段,php,apache,.htaccess,Php,Apache,.htaccess,我当前的网址是 http://foo.com/{first_parameter}/{second_parameter} 现在我想把它重定向到 http://foo.com/{second_parameter} 我如何使用htaccess进行访问 注意:我正在使用apache服务器尝试以下解决方案: RewriteRule ^([^/]*)/(.*)$ /$2 [R=301,L] 您可以看到它正在工作:您想完全释放第一个参数吗???这明智吗???你也试过什么吗?

我当前的网址是

http://foo.com/{first_parameter}/{second_parameter}

现在我想把它重定向到

http://foo.com/{second_parameter}
我如何使用htaccess进行访问

注意:我正在使用apache服务器

尝试以下解决方案:

RewriteRule ^([^/]*)/(.*)$ /$2 [R=301,L]

您可以看到它正在工作:

您想完全释放第一个参数吗???这明智吗???你也试过什么吗?