سلام

این تکه کد را هر کاری کردم که از حالت سابدامین بودن خارج بشه موفق نشدم ! ( یعنی به جای اینکه s1.test.com بشه test.com/s1 )
آیا شما میتونید کمک کنید ؟!
هزینه را هم بفرمایید تا تقدیم گردد .
کد مربوط به httaccess
این تکه کد را هر کاری کردم که از حالت سابدامین بودن خارج بشه موفق نشدم ! ( یعنی به جای اینکه s1.test.com بشه test.com/s1 )
آیا شما میتونید کمک کنید ؟!
هزینه را هم بفرمایید تا تقدیم گردد .
PHP:
<?php
ob_start();
include 'dataload.php';
/********/
ini_set("display_errors","0");
ini_set("register_globals","0");
/********/
$pageid = isset($_GET['pageid'])?intval($_GET['pageid']):'1';
متشکر ;)
$servername = strtolower($_SERVER['SERVER_NAME']);
$servername = (substr($servername,0,4) == 'www.')?substr($servername,4):$servername;
/*
//visit
$res=mysql_query("update `amar` set `count`=count+1 where `date`='".date("Y-m-d")."' limit 1;");
if(mysql_affected_rows()!=1){
mysql_query("INSERT INTO `amar` (`id`, `date`, `count`, `click`) VALUES (NULL, '".date("Y-m-d")."', '1', '0');");
}
*/
#------
if(preg_match('#([a-z0-9-]+?)\.yourdomain\.com#i', $servername, $blogname)){
if(isset($_GET['id']) ){
$res=mysql_query("select id,username from `feeds` where `id`=(select fid from `news_tmp` where `id`=$_GET[id]) limit 1");
if(mysql_num_rows($res)>0){
list($id,$username)=mysql_fetch_array($res);
if($blogname[1]!=$username){
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://$username.yourdomain.com/page-$_GET[id].html" );
exit;
}
}
}
$username=$blogname[1];
$res=mysql_query("select id,title from `feeds` where `username`='{$blogname[1]}'");
if(mysql_num_rows($res)>0){
list($id,$title)=mysql_fetch_array($res);
$res=mysql_query("select `title`,`text`,`date`,`keywords` from `news_tmp` where `fid`=$id ".(isset($_GET['id'])?"and `id`=$_GET[id] ":'')." /*order by `date` DESC*/");
while($row=mysql_fetch_assoc($res)){
if(isset($_GET['id']))$title=$row['title'];
?>
<div class="post-title">
<div class="post-title-space">
<h1><span lang="fa"><?=$row['title'];?></span></h1>
</div>
<div id="post-content">
<div class="post-content-text">
<div class="style2">
<span lang="fa"><?=$row['text'];?></span>
</div>
<div class="clear"></div>
<div class="clear"></div>
</div>
</div>
<div id="post-footer"></div>
</div>
<?
}
}else{
echo 'user not found in feed.';
}
}
else
{
if(isset($_GET['id']) ){
$res=mysql_query("select id,username from `feeds` where `id`=(select fid from `news_tmp` where `id`=$_GET[id]) limit 1");
if(mysql_num_rows($res)>0){
list($id,$username)=mysql_fetch_array($res);
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://$username.yourdomain.com/page-$_GET[id].html" );
exit;
}
}
$res=mysql_query("select `title`,`id` from `news_tmp` order by `date` DESC limit 200");
if(mysql_num_rows($res)>0){
echo '<ul>';
while($row=mysql_fetch_assoc($res)){
echo "<li><a href=\"page-$row[id].html\" target=\"_blank\">$row[title]</a></li>\n";
}
echo '</ul>';
}
echo 'user not found.';
}
$out_html=ob_get_clean();
include 'tmp.php';
?>PHP]]
کد مربوط به httaccess
کد:
RewriteEngine On
#RewriteBase /
RewriteRule page-([0-9]*).html ./index.php?id=$1 [L]
RewriteRule ^list/(.*)-([0-9]*)\.html$ ./search.php?key=$1&start=$2 [L]
RewriteRule ^list/(.*)\.html$ ./search.php?key=$1 [L]
Rewriterule ^rss.xml ./rss/rss.php
### EXPIRES
# month A2592000, week A604800, day A86400, hour A3600,15 min A900
ExpiresActive On
ExpiresDefault A86400
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType text/plain A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A604800
ExpiresByType text/html A900
Last edited: