1

我试图通过以下代码段重写 url download.php 以转换为更友好的 url

RewriteEngine on
RewriteRule ^download-([0-9]+)\.html$ download.php?id=$1

或者

Options +FollowSymLinks
RewriteEngine on
RewriteRule download-id-(.*)\.htm$ download.php?id=$1   

下载.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 模块运行良好,但脚本 url 没有任何变化

任何想法?

4

1 回答 1

1

mod_rewrite 用于后端。这就是它在服务器上的样子。它不是 301 或 302 重定向。

于 2012-05-22T01:49:31.357 回答