ht-access文件重写链接

时间:2016-06-19 15:24:43

标签: javascript apache .htaccess

我的ht访问文件存在问题,我不确定我是否已经接受了这个权利,但如果我要将网址写为http://mywebsite/realfoldername/,那么我需要但是我想转到一个哈希的网址代替。 " mywebsite.com.au/#realfoldername"

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Stereo /#Stereo$1?sent [QSA,NE,R]    //'sent' for JS as variable
RewriteRule ^stereo /#Stereo$1?sent [QSA,NE,R]
RewriteRule ^Television /#Television$1?sent [QSA,NE,R]
RewriteRule ^television /#television$1?sent [QSA,NE,R]
websitename example: www.hifi.com/#__    Folders    
                                    |
                                    --> Stereo/index.html
                                    |
                                    --> Television/index.html
                                    |
                                    -->Contacts/index.html
                              ______|  

网址http://www.hifi.com/#Stereo    或http://www.hifi.com/#Contacts/

 $( document ).ready(function() {
 if(window.location.href.indexOf("sent") > -1) {
     value =  window.location.href.substring(window.location.href.lastIndexOf('/') +
 1).slice(0,-5);
    window.location = value;
    loadPage();
    }else{
    loadPage();
    }
 });
$(window).on("hashchange", function () {
  loadPage(); 
   console.log("fin");
}); 

0 个答案:

没有答案