duanou9758 2014-01-22 20:22
浏览 57

从cook搜索引擎重定向到mysite

My cooking site is indexed by a cook search engine as above example

http://mysitename/content.php?r=101-post1%29-test-20%
http://mysitename/content.php?r=102-post1%250-test2-31%
http://mysitename/content.php?r=103-post1%102-test3-40%

etc...

My site has all this posts in the following form:

http://mysitename/post1%29-test-20%
http://mysitename/post2%29-test-20%
http://mysitename/post3%29-test-20%

Is it possible to make a content.php file to redirect all of these references from cook search engine to my site real post?

EDIT: Thank you for your answer but by mistake i forget to mention that me host provider has lightpd server and .htaccess is useless. Any other solution?


EDIT2: I have tested the second option but no luck again. I realised that the problem is the url because the query from search engine is like:

http://mysitename/content.php?r=153-Χημική-δίαιτα-πολλών-κιλών

and it is in greek language


EDIT 3

I test this code:

<?php
    header("Status: 301 Moved Permanently");
    header("Location:./". $_SERVER['QUERY_STRING']);
    exit;
?> 

who produce the following result:

http://mysitename/r=153-Χημική-δίαιτα-πολλών-κιλών

is there a way to remove the "r=153-" and leave the rest url "Χημική-δίαιτα-πολλών-κιλών" ? like:

http://mysitename/Χημική-δίαιτα-πολλών-κιλών

That would be a perfect solution. Is it possible?

  • 写回答

2条回答 默认 最新

  • doushou6480 2014-01-22 20:44
    关注

    Save the following as an .htaccess file in root web directory:

    Options  +FollowSymLinks +Indexes
    Order deny,allow
    
    RewriteEngine On
    RewriteRule ^([^/]*)$ /content.php?r=$1 [L]
    
    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100