我们已经在网络版本中编写了301重写规则,如下所示,它工作正常
RewriteRule ^staff-benefit-solutions https://www.sample.com/engage-your-employees/ [R=301,L,QSA]
RewriteRule ^corporate-benefits https://www.sample.com/engage-your-employees/ [R=301,L,QSA]
下面是我尝试过的移动版本的301重写规则,如下所示,该规则未重定向
RewriteRule ^m/staff-benefit-solutions https://www.sample.com/engage-your-employees/ [R=301,L,QSA]
RewriteRule ^m/corporate-benefits https://www.sample.com/engage-your-employees/ [R=301,L,QSA]
当在移动浏览器中打开时,我的完整URL会在www.yyy.com/m/staff-benefit-solutions下显示如下内容。这应该重定向到https://www.sample.com/engage-your-employees/。有人可以帮忙吗
答案 0 :(得分:0)
问题是,在VirtualHost或Directory上下文中,您在哪个上下文中使用RewriteRule?我假设是在目录上下文中,因为您标记了.htaccess
。
在每个目录上下文(目录和.htaccess)中,模式为 仅匹配部分路径,例如的请求 “ /app1/index.html”可能会与“ app1 / index.html”进行比较 或“ index.html”,具体取决于定义RewriteRule的位置。
因此,您需要在.htaccess
目录下的root
中而不是m
目录下的 onSelectRow: function(rowid, selected) {
if (this.p.selarrrow.length === currids.length) {
$('#cb_' + $.jgrid.jqID(this.p.id), this.grid.hDiv)[this.p.useProp ? 'prop' : 'attr']("checked", true);
}
if (rowid != null) {
jQuery("#jqGridDetails").jqGrid('setGridParam', {
url: rowid + ".json",
datatype: 'json'
}); // the last setting is for demo only
jQuery("#jqGridDetails").jqGrid('setCaption', 'Detail Grid::' + rowid);
jQuery("#jqGridDetails").trigger("reloadGrid");
}
},
footerrow: true,
gridComplete: function(rowId) {
currids = $(this).jqGrid('getDataIDs');
//$("#1","#jqGrid").css({display:"none"})
var selectedRowsIds = currids;
alert(currids);
//alert(selectedRowsIds);
var totalSum = 0;
$.each(selectedRowsIds, function(index, selectedRowId) {
totalSum += parseInt($('#jqGrid').jqGrid('getCell', selectedRowId, 'AGTE'));
});
$('#lbl_Amount').html(totalSum);
$('#count').html($('#jqGrid').getGridParam('records'));
$('#lbl_SortedBy').html($("#jqGrid").jqGrid('getGridParam', 'sortname'));
},
onSelectRow: function(rowId) {
var selectedRowsIds = $('#jqGrid').jqGrid('getGridParam', 'selarrrow');
//alert(selectedRowsIds);
var totalSum = 0;
$.each(selectedRowsIds, function(index, selectedRowId) {
totalSum += parseInt($('#jqGrid').jqGrid('getCell', selectedRowId, 'AGTE'));
});
$('#jqGrid').jqGrid('footerData', 'set', {
AGTE: totalSum
});
},
});
$('#jqGrid').navGrid('#jqGridPager', {
edit: false,
add: false,
del: false,
search: true,
refresh: true,
view: true,
position: "left",
cloneToTop: true
});
$('#jqGrid').navButtonAdd('#jqGridPager', {
buttonicon: "ui-icon-arrowthickstop-1-s",
title: "Export To Excel",
caption: "Export To Excel",
position: "last",
onClickButton: EtoE
});
$('#jqGrid').navButtonAdd('#jqGridPager', {
buttonicon: "ui-icon-arrowreturnthick-1-w",
title: "Back to Search",
caption: "Back To Search",
position: "last",
onClickButton: BackToSearch
});
$('#jqGrid').navButtonAdd('#jqGridPager', {
buttonicon: "ui-icon-clipboard",
title: "Extract Selection",
caption: "Extract Selection",
position: "last",
onClickButton: EtoEx
});
$('#jqGrid').navButtonAdd('#jqGridPager', {
buttonicon: "ui-icon-gear",
title: "Remove Sort",
caption: "Remove Sort",
position: "last",
onClickButton: RemoveSort
});
// add first custom button
$('#jqGrid').navButtonAdd('#jqGridPager', {
buttonicon: "ui-icon-calculator",
title: "Column chooser",
caption: "Columns",
position: "last",
onClickButton: function() {
// call the column chooser method
jQuery("#jqGrid").jqGrid('columnChooser');
}
});
});
function EtoEx() {
//$('#jqgrid').jqGrid("clearfilters");
$('#jqgrid').jqGrid("removesort");
}
function BackToSearch() {
window.history.back();
}
function EtoE() {
$("#jqGrid").jqGrid("exportToExcel", {
includeLabels: true,
includeGroupHeader: true,
includeFooter: true,
fileName: "Report_Payee.xlsx",
maxlength: 40 // maxlength for visible string data
})
}
function RemoveSort() {
location.reload();
}
function getSelectedRows() {
var grid = $("#jqGrid");
var rowKey = grid.getGridParam("selrow");
if (!rowKey)
alert("No rows are selected");
else {
var selectedIDs = grid.getGridParam("selarrrow");
var result = "";
for (var i = 0; i < selectedIDs.length; i++) {
result += selectedIDs[i] + ",";
}
alert(result);
}
}
中定义重写。