and actually i convert the url with javascript
<script type="text/javascript">
$(document).ready(function() {
$('.search-form').submit(function() {
var value = $('.search-form input:text').val();
value = value = value.replace(/\W/,''); // replace
window.location.href = value + "-keyword" + ".html";
return false;
});
});
</script>
is there a method to convert the url seo-friendly without javascript? maybe with php?
I am for the following technique because
Here goes:
<?php
//receiving page
if(isset($_GET['name_of_submit'], $_GET['search_phrase'])) {
header("Location: /address_to_this_script/".$_GET['search_phrase']);
die;
}
if(isset($_GET['search_phrase'])) {
// handle search and validation here, don't forget to escape it!
}
This is what I would do too, because if anyone links to either URL the link juice will always flow down in the SEO Url eventually. You could use an onclick to take the user to an SEO URL in javascript, but google wont follow it.
One thing you could do is to store those searches in a db and then have them as "related links" (the seo versions) linked to from each page on your site, this way they will get spidered.
The best way is to remove special characters and replace it by the page, category and section names. Regards
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.