【问题标题】:how to rewrite URL having multiple parameters如何重写具有多个参数的 URL
【发布时间】:2016-02-03 02:45:28
【问题描述】:

我有很多页面都有这样的 URL 结构

http://yourwebsite.com/storename?oid=AA112&offid=6

如何使它成为 SEO 友好的 URL,因为 oid 和 offid 表示 oid-orderid 和 offid-offerid。 这些参数是指特定商店的独特优惠,可能会定期更改

【问题讨论】:

  • 您需要哪台网络服务器的帮助?
  • 我无法找到你@mkaatman,但我想知道我的 url 显示是否可以这样被谷歌索引,或者我必须以某些方式重写
  • @mkaatman 询问您是使用 apache 网络服务器还是什么?Seo 是一个广泛的话题,是的,干净的 url 是 seo 的 +..
  • 是的,我正在使用 apache 服务器
  • 在 Disallow: /* 中使用好不好?在 robots.txt 中不索引该 url 参数或任何想法@mkaatman

标签: url url-rewriting seo search-engine


【解决方案1】:

如果您使用的是 Apache,这是一种可能的解决方案。

创建一个入口点。然后你需要编写一个处理 URL 字符串的路由器

htaccess 喜欢:

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

和路由器你想要什么。很简单的例子:

$requestURI = explode("/", $_SERVER['REQUEST_URI']);
if($requestURI[0] == 'index'){
    include('views/index.php');
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    • 1970-01-01
    • 2012-04-06
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多