我之前的自定义谷歌搜索是这样显示的:
(第一个链接)http://raskim.lt/controller/function/音乐?cx=014092587915392242087%3Agc6l6xlpkmq&cof=FORID%3A11&q=this%is%example&sa=搜索
我更改了我的 Google CSE 脚本。现在我正在使用jsapi。我的新搜索生成:
(第二个链接)http://raskim.lt/controller/function/music?q=这%是%例子
如何重写 url,如果有人访问第一个链接,将被重定向到第二个链接?
现在我的 .htaccess 看起来:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -Indexes
RewriteEngine on
#AllowOverride All
#RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.raskim\.lt$
RewriteRule ^(.*)$ http://www.raskim.lt/$1 [L,R=301]
# Restrict your site to only one domain
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
将其添加到您的.htaccess
在你的网络根目录中/
目录
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} &q=([^&]+) [NC]
RewriteRule ^(.*/music)$ $1?q=%1 [R=301,NC,L]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)