Hello, My search script automatically open this page after search form E.g: xxx.com/?title=madonna+music But I have a rewrite url in htaccess and I want to redirect user after search to this url E.g: xxx.com/search/madonna/music/ How can I do that ? Thanks...
Untested. <?php if (stristr($_SERVER["REQUEST_URI"], "/?title=")) { if (!empty($_GET['title'])){ $term = str_replace("+", "/", strip_tags($_GET['title'])); header("Location: http://xxx.com/search/".$term."/"); } else { header("Location: http://xxx.com/"); } } ?> PHP:
header-location is usually pretty buggy unless it comes first in the code, so i would try: header("refresh: 2; url=http://site.php"); // 2 = time to wait before redirecting, in seconds. url is obvious. PHP: hope that helps ya