问题描述:

Im trying to build a portfolio with transition la Medium

So far, Im able to test it online, but when I launch it locally with MAMP, it wont load the content. Instead, I get this error:

Failed to load resource: the server responded with a status of 404 (Not Found) jolinmasson.local:8888/ajax/page:6?_=1397435305669

Why is it asking for the wrong url?

Heres the php/Kirby CMS part of the code:

<?php

$current = $pages->findByUID('home')->children()->visible()->paginate(1);

foreach($current as $p){

$data['title'] = ((string)$p->title);

$data['client'] = ((string)$p->client);

$data['content'] = ((string)kirbytext($p->text));

if($p->hasImages()){

$data['image'] = ((string)$p->images()->first()->url());

};

$data['projet'] = ((string)kirbytext($p->imagesprojet));

}

echo json_encode($data);

?>

And heres part of the JavaScript:

ArticleAnimator.contentizeElement = function($el, d){

$el.find('.big-image').css({ backgroundImage: "url(" + d.image + ")" });

$el.find('h1.title').html(d.title);

$el.find('.client').html(d.client);

$el.find('.content .text').html(d.content);

$el.find('.projet').html(d.projet);

}

网友答案:

Finally managed to get it working with the default kirby .htaccess

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteBase /

RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
RewriteRule ^site/(.*) error [R=301,L]
RewriteRule ^kirby/(.*) error [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>
相关阅读:
Top