我的问题是,我想通过JavaScript重定向到上面的目录。
我的代码:
location.href = (location.href).substr(0, (location.href).lastIndexOf('folder'))
URL看起来是这样的:
example.com/path/folder/index.php ?文件= abc&test = 123 lol =酷
重定向的影响如下:
example.com/path/&test = 123 lol =酷
但要有这个:
example.com/path/
我该怎么做呢?