在HTML页面中使用js,php的SEO友好网址创建

时间:2013-09-16 01:02:14

标签: php jquery html seo

我正在使用html,js和php为客户开发一个网站。对于任何数据库调用,我正在使用ajax调用

$.ajax({
    type: 'POST',
    url: "index2.php",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg, status) {
      dosomething(msg);
     },
     error: function (msg, status) {
          console.log("failure");
          console.log(msg);
     }
 });

和php页面返回输出。问题是index.html页面网址没有改变.....我希望它改变说index.html?id = 23(在html页面中创建查询字符串)

基本上我的目标是使其成为SEO友好的网址,如index.html / helloppl 这样做的最佳方法是什么。谷歌搜索我发现link 做....我仍然需要在这里创建查询字符串...任何帮助表示赞赏。

  1. 创建SEO fridenly url。
  2. 在html中创建查询字符串

1 个答案:

答案 0 :(得分:0)

问题是index.html页面网址没有被更改。我希望它改变说index.html?id=23(在html页面中创建查询字符串)

Ans:如果你想像上面提到的那样更改网址,那么ajax就不会这样做了。这可以通过简单的方式完成,转到我提供的网址并查看主题。

http://html.net/tutorials/php/lesson10.php

基本上我的目标是使其成为SEO友好的网址,如index.html/helloppl。这样做的最佳方法是什么。谷歌搜索时,我找到了这样做的链接。我仍然需要在这里创建查询字符串。

Ans:这可以通过htaccess来完成。转到链接

Jquery ajax() messing with my .htaccess mod_rewrite