简体   繁体   中英

Renaming URL in php not working

I'm writing this:

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]

in order rename from pages/title?id_article=2 to pages/title

but it doesn't work. Any advice please? Thank you in advance.

If you want to do it with PHP, following is the script:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM