简体   繁体   English

javascript或htaccess重写网址

[英]javascript or htaccess rewrite url

Recently i walked through many .htaccess rewrite url(user-friendly url) tutorials.that is to write url like following. 最近,我浏览了许多.htaccess重写url(用户友好的url)教程。

domain.com/product/item1

I want to know is there any way to do this type of stuff with javascript? 我想知道有没有办法用javascript做这类事情? May be its not possible but the following kind of stuff may be possible with javascript 可能是不可能的,但是使用javascript可能有以下几种

domain.com/index.php/my-product

example webbsite: http://10deals.in/index.php/beauty-spas 示例网站: http ://10deals.in/index.php/beauty-spas

I tried to google this stuff but failed.plz link any tutorial or explain something about this. 我试图用谷歌搜索这个东西,但是失败了。请链接任何教程或解释一下。

Any help is appreciated... 任何帮助表示赞赏...

You can't. 你不能

Your url will always try to load a file from that path, since JS only runs as soon as it's loaded, client-side. 您的网址将始终尝试从该路径加载文件,因为JS仅在客户端加载后才运行。
By then, a redirect would be a bit pointless. 届时,重定向将毫无意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM