我尝试通过以下代码段重写url download.php以转换为更友好的网址
RewriteEngine on
RewriteRule ^download-([0-9]+)\.html$ download.php?id=$1
或
Options +FollowSymLinks
RewriteEngine on
RewriteRule download-id-(.*)\.htm$ download.php?id=$1
的download.php
<?php
include "funcs.php";
if(!isset($core->id))
die("404 - Not found!"); // Add a header() line of code to make it a real 404
if(!$download = $core->fetchDownload())
die("404 - Not found!");
$download = $core->fetchDownload(true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> <?=$download['title']?></title>
<meta name="keywords" content="Place your keywords here" />
<meta name="description" content="Place your description here" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery.google_menu.js"></script>
<link rel="stylesheet" type="text/css" href="css/google_menu.css"/>
<script>
$('document').ready(function(){
$('.menu').fixedMenu();
});
<!--
function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('resize').contentWindow.
document.body.scrollHeight;
//change the height of the iframe
document.getElementById('resize').height=
the_height;
}
//-->
</script>
</head>
<body>
<!--facebook -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=132097543481293";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!--facebook -->
<div class="menu">
<ul>
<li class="single-link"><!-- Using class="single-link" for links with no dropdown -->
<!--<a target="_blank" href="#"><h2 dir="rtl"><?=$download['title']?></h2><br /></a>-->
</li>
<!-- Using class="current" for the link of the current page -->
<li class="current">
<a target="_blank" href="#"><small dir="rtl">فى قسم : <?=$download['type']?> </small></a>
</li>
<li class="single-link"><!-- Using class="single-link" for links with no dropdown -->
<a target="_blank" href="#">المشاهدات: <?=$download['views']?></a>
</li>
<li class="single-link"><!-- Using class="single-link" for links with no dropdown -->
<a href="http://<?=$download['surl']?>" target="_top" > <?=$download['sname']?> </a>
</li>
<li class="single-link"><!-- Using class="single-link" for links with no dropdown -->
<a href="<?=$download['url']?>" target="_top" > عرض الصفحة كاملة </a>
</li>
<li class="single-link"><!-- Using class="single-link" for links with no dropdown -->
<div id="fbook"> <fb:like send="false" layout="box_count" width="40" show_faces="false"></fb:like></div>
</li>
</ul>
<a href="contact_us.php" ><img style="margin:10px 0 0 5px;" src="adsimg/topleft.jpg" width="389" height="73" /></a>
</div>
<iframe onLoad="calcHeight();" scrolling="yes" frameborder="1" width="100%" height="2000" name="resize" id="resize" src="<?=$download['url'] ?>" />
<?=$core->templateVar("downloadRating")?>
</body>
<?php
?>
但它没有用,虽然apache和rewrite模块运行良好,但脚本网址没有任何改变
任何想法?
答案 0 :(得分:1)
mod_rewrite用于后端。这就是它对服务器的看法。它不是301或302重定向。