0
我們正在使用我們的電子商務網站ECT模板,並安裝了程序員的代碼,將動態網址更改爲靜態。然而,我們有一些反向鏈接,我們希望重定向到適當的頁面(或者我們會將它們全部發送到我們設置的「所有產品」頁面。我們目前的重定向頁面返回一個頁面,顯示「此產品已被刪除「不好將動態添加到靜態代碼後重定向不起作用
下面是是對動態的htaccess文件的靜態代碼:!
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*)$ /handle_url.php [L]
這裏是在handle_url.php文件中的代碼:
<?php
ob_start();
session_start();
include "vsadmin/db_conn_open.php";
function sli_escape_string($estr){
if(version_compare(phpversion(),'4.3.0')=='-1') return(mysql_escape_string(trim($estr))); else return(mysql_real_escape_string(trim($estr)));
}
$url = $_SERVER['REQUEST_URI'];
$url = trim($url, "/");
$pos = strpos($url,'?');
if ($pos > 0){
$url = substr($url,0,$pos);
}
$pos = strpos($url,".");
if ($pos > 0){
$urlspec = substr($url, 0, $pos);
} else {
}
$store_url = $url;
$sSQL = "SELECT pID FROM products WHERE pURL='" . sli_escape_string($url) . "'";
$query = mysql_query($sSQL);
if ($query && mysql_num_rows($query)>0){
$rs = mysql_fetch_assoc($query);
$_GET['prod']=$rs['pID'];
$explicitid=$rs['pID'];
include "proddetail.php";
$plid = $explicitid;
} else {
$sSQL = "SELECT sectionID, rootSection FROM sections WHERE sectionURL='".sli_escape_string($url)."'";
$query = mysql_query($sSQL);
if ($query && mysql_num_rows($query)>0){
$rs = mysql_fetch_assoc($query);
$_GET['cat']=$rs['sectionID'];
$explicitid=$rs['sectionID'];
$secid = $explicitid;
if ($rs['rootSection']==1){
include "products.php";
} else {
include "categories.php";
}
} else {
include "content.php";
}
}
// For sections we want the .html
?>
這裏是我沒有成功嘗試使用送舊動態鏈接靜態頁面(沒有換行符):
redirect 301 /proddetail.php?prod=cooling-hydration-backpack-system http://www.veskimo.com/cooling-hydration-backpack-system.html
我如此欣賞任何幫助,您可以給我。我承認我對此有點不滿。 非常感謝, Janell
非常感謝你!這工作完美。你是如此善良的幫助!乾杯,珍妮 – user1185809 2012-02-02 22:12:56