Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.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中重命名URL不起作用_Php_.htaccess_Url Rewriting - Fatal编程技术网

在php中重命名URL不起作用

在php中重命名URL不起作用,php,.htaccess,url-rewriting,Php,.htaccess,Url Rewriting,我在写这个: RewriteRule ^title$ articles.php?&=stop [QSA,L,N,S=15] RewriteCond %{QUERY_STRING} !stop RewriteRule articles.php? http://mysite.com/pages/title [r=301,L,nc] 为了从页面/标题?id_article=2重命名为页面/标题 但它不起作用。 有什么建议吗? 提前感谢您。如果您想使用PHP进行此操作,以下是脚本: <

我在写这个:

RewriteRule ^title$  articles.php?&=stop [QSA,L,N,S=15]
RewriteCond %{QUERY_STRING} !stop 
RewriteRule articles.php? http://mysite.com/pages/title [r=301,L,nc]
为了从
页面/标题?id_article=2
重命名为
页面/标题

但它不起作用。 有什么建议吗?
提前感谢您。

如果您想使用PHP进行此操作,以下是脚本:

<?php
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

$url = explode('?', $url);

if(!empty($url[1])) 
{
header("Location: http://".$url[0]);
}
?>


将页面/标题?id_article=2更改为页面/标题/2或页面/标题本身??页面/标题本身。。。有什么想法吗?我把标题搞错了。更好:使用HTACCESS重命名PHP URL。但谢谢你的回答。我打赌这对我在标题中的问题来说是个好问题。但对我真正的问题有什么想法吗?@duracell抱歉。。。不知道,我不知道