在我的网站中我使用网址重写但是当我使用js进行重定向时遇到问题
<div class="bttn redirect" data-url="bar/">GO</div>
$('.bttn.redirect').on('click', function() {
var url = $(this).attr('data-url');
if (typeof url === 'undefined' || url === null || url === "") {
url = '.';
}
//window.location.href = url; <-- Add bar/ to original
//window.location.replace(url); <-- Add bar/ to original
//document.location.href = 'url'; <-- Add bar/ to original
//location.replace(url); <-- Add bar/ to original
});
--> original url = mydomain.com/foo/
--> redirected url = mydomain.com/foo/bar/
相反,如果我使用html href一切正常
<a href="href="bar/">GO</a>
--> original url = mydomain.com/foo/
--> redirected url = mydomain.com/bar/
的.htaccess
..
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?act=$1&vid=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?act=$1 [L,QSA]
我该如何解决?谢谢