hello
i have .htaccess for clean url of title, my problem is with persian to url. if persian be to url that page have error 404 else not error and that page is true. why and what do i do?
codes:
.htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+)$ article.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+)/$ article.php?url=$1
Insert to databes(php):
<?php
include('config.php');
function string_limit_words($string, $word_limit) {
$words = explode(' ', $string);
return implode(' ', array_slice($words, 0, $word_limit));
}
$blog='';
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$title=mysql_real_escape_string($_POST['title']);
$body=mysql_real_escape_string($_POST['body']);
$title=htmlentities($title);
$body=htmlentities($body);
$date=date("Y/m/d");
$newtitle=string_limit_words($title, 6);
$urltitle=preg_replace('/[^a-z0-9]/i',' ', $newtitle);
$newurltitle=str_replace(" ","-",$newtitle);
$url=$newurltitle;
mysql_query("insert into blog(title,body,url) values('$title','$body','$url')");
if(isset($newurltitle)){
$blogurl="http://localhost/seo/$url";
}
}
?>
get url and show info of database:
<?php
include('config.php');
if($_GET['url'])
{
$url=mysql_real_escape_string($_GET['url']);
$url=$url;
$sql=mysql_query("select title,body from blog where url='$url'");
$count=mysql_num_rows($sql);
$row=mysql_fetch_array($sql);
$title=$row['title'];
$body=$row['body'];
}
else
{
echo '404 Not URL Available.';
}
?>