Jquery Wordpress-主页上的深度链接不起作用

Jquery Wordpress-主页上的深度链接不起作用,jquery,wordpress,html,browser-history,deep-linking,Jquery,Wordpress,Html,Browser History,Deep Linking,我一直致力于将深度链接集成到我正在开发的wordpress网站中; 问题是,它在子页面上工作,而不是在主页上。例如,这是有效的 但事实并非如此 我使用Modernizer检查HTML5历史记录,并使用jquery地址作为后备 function initUrlHandler() { if(Modernizr.history) { if(window.location.hash != '') { changeUrl({}, window.l

我一直致力于将深度链接集成到我正在开发的wordpress网站中;

问题是,它在子页面上工作,而不是在主页上。例如,这是有效的

但事实并非如此

我使用Modernizer检查HTML5历史记录,并使用jquery地址作为后备

function initUrlHandler() {
    if(Modernizr.history) {
         if(window.location.hash != '') {
              changeUrl({}, window.location.hash.replace('#/', '/'));
         }

         window.addEventListener('popstate', function(e) {
              onUrlChange(window.location.pathname);
         },true);
    } else {
         if(window.location.pathname.length > 1) {
              window.location.href = '/#'+window.location.pathname;
         }

         $.address.externalChange(function(event) {
              onUrlChange(event.value);
         });

         onUrlChange(window.location.hash);
    }


    if(firstUrlChange) {
        onUrlChange(document.location.pathname);
    }
}

function changeUrl(state,url) {
    if(Modernizr.history) {
         history.pushState(state, null, '/'+url);
    } else {
         window.location.hash = '/'+url;
    }
}

function onUrlChange(pathName) {
    var pathSplit = pathName.match(/(\d+)/);

    currentSlide = (pathSplit == NaN || pathSplit == undefined || pathSplit > options.slides.length) ? 0 : parseInt(pathSplit)-1;   


    if(firstUrlChange) {
         firstUrlChange = false;
         loadInitImages();
    }
两个示例中使用的模板相同。。放置在init func
initUrlHandler()
中的
alert()
不会返回任何内容,这让我想到可能是
.htaccess
文件出错了

我已经看过了,但还没找到问题

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>

# END WordPress
#开始WordPress
重新启动发动机
重写库/可湿性粉剂/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/wp/index.php[L]
#结束WordPress
谢谢你的帮助,真的卡住了

试试这个:)

#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-d[或]
#wp基本文件夹
重写cond%{REQUEST_URI}^/wp/?
重写规则/index.php[L]
#结束WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
# wp base folder
RewriteCond %{REQUEST_URI} ^/wp/?
RewriteRule . /index.php [L]
</IfModule>
# END WordPress