2015-09-02 13:35
浏览 38


I want to be able to redirect url such as to new domain and url such as

Also, the number in the url 426 will change often, it could also be 1 or whatever number up to 500

How can I do this in .htaccess file?

Also, the redirect must work with this code that sends the people who come from bing ONLY to the new url. If a person just enters the url then he will not be redirected but when he comes from bing or from whatever specified referrer then he will be redirected.

Thus far I have this code that I used for my old site that had cat-x in the url but I don't know how to change the code to work with only a number in the url instead of cat-x

 RewriteEngine On
 RewriteCond %{HTTP_REFERER} (bing)
 RewriteCond %{HTTP_HOST} ^(?:www\.)?server10\.olddomain\.com$ [NC]
 RewriteRule ^cat-\d+/(.+?)\.html$$1 [L,QSA,R=302]

图片转代码服务由CSDN问答提供 功能建议

我希望能够重定向网址,例如 -kw.html 到新域名和网址,例如

此外, url 426 中的数字会经常更改,也可能是 1 或任何数字,直到 500


此外,重定向必须使用此代码,该代码将来自bing的人员仅发送到新网址。 如果一个人只是输入了网址,那么他就不会被重定向,但是当他来自bing或来自任何指定的推荐人时,他将被重定向。

到目前为止,我有这个代码我用过 对于我的旧网站,在网址中有 cat-x ,但我不知道如何更改代码只使用网址中的数字代替 cat-x

  RewriteEngine On 
 RewriteCond%{HTTP_HOST} ^(?:www \。)?server10 \ .olddomain \ .com  $ [NC] 
 RewriteRule ^ cat- \ d + /(。+?)\。html $$1 [L,QSA,R = 302] 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douduo2407 2015-09-02 14:56

    Just remove the cat- part:

     RewriteEngine On
     RewriteCond %{HTTP_REFERER} (bing)
     RewriteCond %{HTTP_HOST} ^(?:www\.)?server10\.olddomain\.com$ [NC]
     RewriteRule ^\d+/(.+?)\.html$$1 [L,QSA,R=302]
    解决 无用
    打赏 举报

相关推荐 更多相似问题