Jump to content
Larry Ullman's Book Forums

Recommended Posts

I have my own website that I am trying to install clean search engine friendly urls on. 

I am doing this for the article page section of my site. 

I have it working except for a glitch. I am comparing my setup with that of this website and others which use htaccess clean urls. 

So basically I have my url which is like the following.



it works when I click on it and everything is fine. but if I take a part of the url like so:



and refresh it still works which is ok. but the url doesn't return to the former one, it stays like that, missing part of the title in the url. 


I can't figure out how to make it revert back to the original url. All pages which seem to use clean urls have it working like that. here is my htaccess rule. and then I will show you the link I am using to link to the page. 


RewriteEngine On
RewriteRule ^article/([0-9]+)/([a-zA-Z]+) article.php?id=$1&title=$2
$punctuation = array('$', '-', ',', '/', '\\', '!', '.', ' ', '*', '&', '?', '%', '\'', '<', '>', '[', ']', '(', ')');
$real_title = str_replace($punctuation, '-', $row5['title']);
$real_title = str_replace(' ', '-', $real_title);
$real_title = strtolower($real_title);
$real_title = mysqli_real_escape_string($dbc, $real_title);
<a href="http://www.example.com/article/'.$row5['article_id'].'/'.$real_title.'">'.$row5['title'].'</a>
Link to comment
Share on other sites


  • Create New...