.htaccess 重写谷歌自定义搜索字符串
我以前的自定义谷歌搜索是这样出现的: (第一个链接)http:/raskim.lt/controller/function/music?cx=014092587915392242087%3agc6lxlpkmq&cof=FORID%3A11&q=this%is%example&sa=Search 我更改了我的谷歌CSE脚本。现在我使用jsapi。我的新搜索生成: (第二个链接)http:/raskim.lt/controller/function/music?q=this%是%example 如何重写url,若有人访问第一个链接,将重定向到第二个链接 现在,我的.htaccess看起来:.htaccess 重写谷歌自定义搜索字符串,.htaccess,mod-rewrite,url-rewriting,url-redirection,.htaccess,Mod Rewrite,Url Rewriting,Url Redirection,我以前的自定义谷歌搜索是这样出现的: (第一个链接)http:/raskim.lt/controller/function/music?cx=014092587915392242087%3agc6lxlpkmq&cof=FORID%3A11&q=this%is%example&sa=Search 我更改了我的谷歌CSE脚本。现在我使用jsapi。我的新搜索生成: (第二个链接)http:/raskim.lt/controller/function/music?q=this%是%example 如
<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>
选项+FollowSymLinks-索引
重新启动发动机
#允许超越所有
#重写基/
重写cond%{HTTP_HOST}^www\.raskim\.lt$
重写规则^(.*)$http://www.raskim.lt/$1[L,R=301]
#将您的站点仅限于一个域
#重写cond%{HTTP_HOST}^www\。
#重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
重写规则^(.*)$index.php?/$1[L]
将其添加到web根目录中的
.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} &q=([^&]+) [NC]
RewriteRule ^(.*/music)$ $1?q=%1 [R=301,NC,L]
在将此代码添加到我的.htaccess之后,我在我的url中得到了此代码,我想这是因为我的其他人重写了规则,用当前的htaccess代码更新了您的qn。还有其他规定吗?有。这些-
Options+FollowSymLinks-索引重写引擎在#AllowOverride All#RewriteBase/RewriteCond%{HTTP#u HOST}上^www\.raskim\.lt$RewriteRule^(.*)$http://www.raskim.lt/$1[L,R=301]#将您的站点限制为一个域#RewriteCond%{HTTP_HOST}^www\。#重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L]RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则^(.*)$index.php?/$1[L]重写规则^(.*)$index.php?/$1[L]
您的重写库
已用注释掉。您可以启用然后再试一次吗?如果不起作用,也可以在“重写库”打开和关闭的情况下尝试/$1
。根据Ravi Thapliyal的说法,我启用了这一行“重写库”,现在我的问题解决了。重写正在起作用