SEO友好的URL输出无样式的HTML页面与PHP



我有一个问题与我的URL重写。链接可以工作,但输出的是普通的无样式HTML。以前没有见过这个,或者我忽略了一些非常简单的东西,所以任何帮助都会非常感激。

这是我的。haccess重写

RewriteRule ^gallery/([0-9]+)/([a-zA-Z0-9_-]+) gallery.php?id=$1
这是我的php函数
function url_slug($string, $space = '-') {
    $string = str_replace('&', 'and', $string);
    $string = preg_replace('/[^a-zA-Z0-9 _-]/', '', $string);
    $string = strtolower($string);
    $string = preg_replace('/[ ]+/', ' ', $string);
    $string = str_replace(' ', $space, $string);
    return $string;
}

这是我的索引页与画廊部分

<?php
$sql = DB::getInstance()->query('SELECT * FROM gallery ORDER BY id ASC LIMIT 0, 6');
foreach($sql->results() as $row) {
?>
<div class="col-md-4 col-sm-6 port-item">
    <div class="port-mask">
    <?php
    $id     = escape($row->id);
    $title  = escape($row->url);
    $string = url_slug($title);
    echo '<a href="gallery/' . $id . '/' . $string . '"><h3>' . escape($row->section_title) . '</h3></a>';
    ?>
    <div class="port-line clearfix"></div>
        <p><?php echo escape($row->section_category) ?></p>
        <?php
        echo '<a href="gallery/' . $id . '/' . $string . '"><i class="viewbtn fa fa-long-arrow-right"></i></a>';
        ?>
        <a href="images/gallery/<?php echo escape($row->section_image) ?>" data-rel="prettyPhoto"><i class="viewimg fa fa-search"></i></a>
        </div>
        <img src="images/gallery/<?php echo escape($row->section_image) ?>" alt="<?php echo escape($row->alt) ?>">
</div>
<?php
}
?>

这是我的gallery.php从上面的链接

<?php
$sql = DB::getInstance()->get('gallery', array('id', '=', Input::get('id')));
foreach($sql->results() as $row) {
?>
    <section class="top-content clearfix">
        <div class="clearfix big-box para-opacity" data-auto-play="9000" data-stellar-ratio="0.4" data-stellar-position-property="position">
            <div class="box-title">
                <p><?php echo escape($row->gallery_slider_p) ?></p>
                <div class="clearfix"></div>
                <h3><?php echo escape($row->gallery_slider_h3) ?></h3>
            </div>
            <div class="works-slider slider" data-auto-play="9000">
                <div class="slide img-bg clearfix" data-background="images/gallery/<?php echo escape($row->gallery_slider) ?>"></div>
            </div>
        </div>
    </section>
<?php
}
?>

点击后的URL链接如下所示

http://localhost/projects/XXXPROJECTXXX/index
php

http://localhost/projects/XXXPROJECTXXX/gallery/1/chinese-contemporary-abstract-lady

那么,怎么了??提前感谢:-)

你可以修改所有的 url

形象

js

css

最新更新