我知道这方面有上千个重复的帖子,但到目前为止还没有对我起作用。
我试图使用重写规则将/articulo.html?id=friendly-url转换为/articulo/friendly-url
这是我在.htaccess中使用的,但没有成功:
RewriteEngine On
RewriteRule ^articulo/(.*)$ /articulo.html?id=$1 [L]编辑:
这是查找id param的js:
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
console.warn(sPageURL);
console.warn(sURLVariables);
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};发布于 2016-11-08 12:48:51
像这样试试,
Options -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^articulo/(.*)$ articulo.html?id=$1 [L]https://stackoverflow.com/questions/40487321
复制相似问题