2011-12-12 84 views
0

我一直在努力将深入链接集成到一个WordPress的网站即时开发; http://dhp.camoconnell.com/WordPress的 - 深度链接在主页上不起作用

这个问题,它是在子页面而不是在主页上工作。例如,这个工程

http://dhp.camoconnell.com/portfolio/snow/5

但是这不,

http://dhp.camoconnell.com/2

我使用Modernizr的检查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()没有返回,这使我认为也许.htaccess文件interferring的alert()

我已经看过它,但没有设法找到一个问题。

# 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 

感谢您的帮助,真的卡住

回答

1

试试这个:)

# 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 
相关问题