我正在使用jquery将数据发送到另一个页面。但url不好看,所以我想把它作为SEO友好的URL。如何将链接转换为jQuery中的seo友好url
下面是我的脚本:
function set_item(item) {
// change input value
$('#searchitem').val(item);
// hide proposition list
$('#search_list_id').hide();
var location = $('#search_location').val().split(',');
var search_term = $('#searchitem').val();
var query =encodeURIComponent(search_term);
if(search_term != '' && location !=''){
window.location.href = 'search.php?location=' + location[0] + '&search_term='+ query;
}
}
现在我的网址显示,如:
http://www.zesteve.com/search.php?location=Hyderabad&search_term=Traditions%20Events%20Management%20%26%20Marketing%20Pvt%20Ltd
但我想下面想:
http://www.zesteve.com/search/Hyderabad/Traditions-Events-Management-&-Marketing-Pvt-Ltd
我不知道这样做我需要使用.htaccess
或任何额外的jQuery?
谷歌“URL重写”或“漂亮网址” –
我使用window.location.href –
......这无关与URL重写... –