【问题标题】:htaccess redirection for query string查询字符串的htaccess重定向
【发布时间】:2013-05-24 07:08:01
【问题描述】:

我想使用 .htaccess 将我的动态 URL 重定向到静态以实现 SEO 目的。 网址如下:

  1. http://www.manpowersupplyfromnepal.com/index.php?page=home
  2. /index.php?page=about-us

等等

我想分别制作如下。

  1. http://www.manpowersupplyfromnepal.com/

  2. /about-us

请以适当的解决方案回复我。我将不胜感激。

谢谢,

尼丁

【问题讨论】:

    标签: .htaccess redirect query-string


    【解决方案1】:

    请看下面的代码它会帮助你请试试这个

    RewriteCond %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^page=home$
    RewriteRule ^(.*)$  http://www.manpowersupplyfromnepal.com/home? [R=301,L]
    RewriteCond %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^page=about-us$
    RewriteRule ^(.*)$  http://www.manpowersupplyfromnepal.com/about-us? [R=301,L]
    

    另类

    RewriteCond %{REQUEST_URI} ^/index\.php$
    RewriteCond %{QUERY_STRING} ^page=about-us$
    RewriteRule ^(.*)$  http://www.manpowersupplyfromnepal.com/about-us? [R=301,L]
    

    这将永久重定向 URL,并且您将获得所需的 URL 而无需查询字符串

    【讨论】:

      猜你喜欢
      • 2015-03-31
      • 1970-01-01
      • 1970-01-01
      • 2017-04-13
      • 2010-11-06
      • 2014-05-10
      • 2011-08-03
      • 1970-01-01
      相关资源
      最近更新 更多