Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.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代码将此字符串转换为另一个字符串_Php_.htaccess_Url_Web_Url Rewriting - Fatal编程技术网

Php 使用Htaccess代码将此字符串转换为另一个字符串

Php 使用Htaccess代码将此字符串转换为另一个字符串,php,.htaccess,url,web,url-rewriting,Php,.htaccess,Url,Web,Url Rewriting,我现在有这个网址: new.php?news&post=111&title=XXXX 我想要这个网址: new/news/111/XXXX 如何使用Htaccess实现这一点 我试图用mod_rewrite转换这个,但是我不能 试试这个 RewriteRule ^/new/news/([^/]+)/([^/]+) /new.php?news&post=$1&title=$2 @浏览器中的Pafo您提供的URL是什么??TNx,我正在测试并修复我自己的代码,很

我现在有这个网址:

new.php?news&post=111&title=XXXX
我想要这个网址:

new/news/111/XXXX
如何使用Htaccess实现这一点

我试图用mod_rewrite转换这个,但是我不能

试试这个

RewriteRule ^/new/news/([^/]+)/([^/]+) /new.php?news&post=$1&title=$2

@浏览器中的Pafo您提供的URL是什么??TNx,我正在测试并修复我自己的代码,很快将检查ht代码:XWorked,但如果我打开
http://localhost/new/news/218/XXX/
它会打开,但如果我打开
http://localhost/fa/news/218/XXX
(如果末尾没有
/
,它将无法打开!)如何解决这个问题?你想说的是
http://localhost/new/news/218/XXX/
正在工作,但
http://localhost/new/news/218/XXX
不工作??