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重写规则URL的_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess htaccess重写规则URL的

.htaccess htaccess重写规则URL的,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我使用htaccess重写我的URL,因此我有: RewriteRule ^([^-]+),([a-z0-9._.-]+),([^-]+) index.php?go=$1&lang=$2 [L] 和PHP代码: function rewrite_seo($id, $title, $langs) { global $core; if($core->getSettings('seof')) { $result = $id.','.$langs.','.

我使用htaccess重写我的URL,因此我有:

RewriteRule ^([^-]+),([a-z0-9._.-]+),([^-]+) index.php?go=$1&lang=$2 [L]
和PHP代码:

function rewrite_seo($id, $title, $langs) {
    global $core;
    if($core->getSettings('seof')) {
        $result = $id.','.$langs.','.changeSigns($title).'';
    } else $result = '?go='.$id.'&lang='.$langs;
    return $result;
}
我的URL看起来像:

http://localhost/script/12,en,home
但是你想看起来像这样:

http://localhost/script/en/home,12
如何修改此代码

localhost/script/12,en,home TO localhost/script/en/home,12

你试过修改第4行吗

请指出: $result=$langs.'/'.changeSigns$title.','.$id


请查看PHP.net网页

您必须更改前面答案中指出的用PHP编写的链接:

$result = $langs.'/'.changeSigns($title).','.$id;
然后更改htaccess中的匹配规则:

RewriteRule ^([a-z0-9._.-]+)\/([^-]+),([^-]+) index.php?go=$2&lang=$1 [L]
更好的是,您可以创建更具体的capture正则表达式,以便更容易阅读和理解:

RewriteRule ^([a-z]+)\/([0-9]+),([^-]+) index.php?go=$2&lang=$1 [L]

是的,但我有一个404错误,因为我必须修改httacces,但我不能。因此,发布htaccess规则,或者尝试根据该规则进行更改:D新规则。