Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 如何重写url以将最后一条路径拆分为;点“;并通过拆分的项重定向到查询字符串?_.htaccess_Redirect_Mod Rewrite_Url Rewriting_Url Redirection - Fatal编程技术网

.htaccess 如何重写url以将最后一条路径拆分为;点“;并通过拆分的项重定向到查询字符串?

.htaccess 如何重写url以将最后一条路径拆分为;点“;并通过拆分的项重定向到查询字符串?,.htaccess,redirect,mod-rewrite,url-rewriting,url-redirection,.htaccess,Redirect,Mod Rewrite,Url Rewriting,Url Redirection,我有一个whois表单,它使用get查询字符串并生成结果 我想从以下位置重定向url: mysite.com/domain/google.com 到 mysite.com/domain?sld=google&tld=com 谢谢你的光临 例如,试试这个-- 或 通过jquery尝试使用任何url var baseurl = "mysite.com/domain/"; var a = window.location.pathname.split("/").pop(); var name = a.s

我有一个whois表单,它使用get查询字符串并生成结果

我想从以下位置重定向url:

mysite.com/domain/google.com

mysite.com/domain?sld=google&tld=com

谢谢你的光临 例如,试试这个--

通过jquery尝试使用任何url

var baseurl = "mysite.com/domain/";
var a = window.location.pathname.split("/").pop();
var name = a.split(".")[0];
var name1 = a.split(".")[1];
alert(name);
alert(name1);
alert(baseurl+'?sld='+name+'&tld='+name1);
window.open(baseurl+'?sld='+name+'&tld='+name1);

希望它能为您工作

请显示。htaccess代码它是wordpress的默认代码,没有特殊代码。
#在RewriteBase/RewriteRule^index\上启动wordpress RewriteEngine。php$-[L]RewriteCond%{REQUEST\U FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则/index.php[L]#结束WordPress
Thank bro。但google.com就是一个例子。我希望它可以与任何url一起使用。@MohammadJ:是的,您可以用于任何url我是指用户可以搜索的任何随机url。@MohammadJ:我更新了我的答案,请检查
var baseurl = "mysite.com/domain/";
var a = window.location.pathname.split("/").pop();
var name = a.split(".")[0];
var name1 = a.split(".")[1];
alert(name);
alert(name1);
alert(baseurl+'?sld='+name+'&tld='+name1);
window.open(baseurl+'?sld='+name+'&tld='+name1);