【发布时间】:2012-10-29 05:14:38
【问题描述】:
我的 .htaccess 文件需要帮助.. 现在我有这样的链接 http://www.afrogfx.com/20121028050853/Test.html 斜线 / 的问题!!如果您单击我的链接,您会发现没有样式的链接如果删除斜杠,您将得到 404 Not Found Like That http://www.afrogfx.com/20121028050853Test.html 试试看 !! 这是我的 .htaccess
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ readmore.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ readmore.php?url=$1
readmore.php
<?php
include ('config/connect_to_mysql.php');
$url=$_GET['url'];
if($_GET['url'])
{
$url=mysql_real_escape_string($_GET['url']);
$url=$url.'.html'; //Friendly URL
$sql=mysql_query("select * from posts where url='$url'");
$count=mysql_num_rows($sql);
$row=mysql_fetch_array($sql);
$title=$row['title'];
$text=$row['text'];
}
else
{
echo '404 Page.';
}
?>
这里有问题
<?php
include('styles/header.php');
include ('styles/leftblock.php');
include ('styles/mrnuleft.php');
?>
<?php
if($count)
{
echo "<h1>$title</h1><div class='text'>$text</div>";
}
else
{
echo "<h1>404 Page.</h1>";
}
?>
【问题讨论】:
-
@Brendan Scarvell 谢谢你我知道如果我从根加载(代码)没有 incloud 它会工作,但我需要 incloud
标签: php .htaccess mod-rewrite url-rewriting rewrite