我一直致力于将深层链接整合到一个正在开发的wordpress网站中; http://dhp.camoconnell.com/
问题是,它正在处理子页面而不是主页。例如,这可行http://dhp.camoconnell.com/portfolio/snow/5
但这不,
我正在使用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 alert()
中的initUrlHandler()
不返回任何内容,这让我想到.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
感谢您的帮助,真的卡住了
答案 0 :(得分: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