المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : تحويل روابط منتداك من php لـ html وكسب صداقة محركات البحث



salima
11-01-2013, بتوقيت غرينيتش 09:56 PM
بسم الله

السلام عليكم

كيف حالكم يا اعضاء سوالف

هذا الموضوع يشرح طريقة كيف تحويل روابط منتداك من php الى html كي يكون صديق لمحركات البحث

اول شي نعمل ملف htaccess ونضعه في المجلد الرئيسي للمنتدى

ونضع بداخله هذي الاكواد

رمز PHP:

<code style="white-space:nowrap"> <code> Options +FollowSymLinks
RewriteEngine on
RewriteRule ^getdaily.html$ search.php?do=getdaily &#91;L&#93;
RewriteRule ^getdaily(&#91;0-9&#93;+).html$ search.php?do=getdaily&f=$1 &#91;L&#93;
RewriteRule ^unanswered.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1 &#91;L&#93;
RewriteRule ^unanswered(&#91;0-9&#93;+).html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 &#91;L&#93;
RewriteRule ^forum(&#91;0-9&#93;+).html$ forumdisplay.php?f=$1 &#91;L&#93;
RewriteRule ^forum(&#91;0-9&#93;+)-(&#91;0-9&#93;+)-(&#91;a-z&#93;+)-(.*)-(&#91;0-9&#93;+)-(.*).html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 &#91;L&#93;
RewriteRule ^forum(&#91;0-9&#93;+)-(.*)-(&#91;a-z&#93;+)-(&#91;a-z&#93;+).html$ forumdisplay.php?f=$1&daysprune=$2&order=$3&sort=$4 &#91;L&#93;
RewriteRule ^announcement(&#91;0-9&#93;+).html$ announcement.php?f=$1 &#91;L&#93;
RewriteRule ^announcement(&#91;0-9&#93;+)-(&#91;0-9&#93;+).html$ announcement.php?f=$1&announcementid=$2 &#91;L&#93;
RewriteRule ^thread(&#91;0-9&#93;+).html$ showthread.php?t=$1 &#91;L&#93;
RewriteRule ^thread(&#91;0-9&#93;+)-(&#91;0-9&#93;+).html$ showthread.php?t=$1&page=$2 &#91;L&#93;
RewriteRule ^getnew.html$ search.php?do=getnew &#91;L&#93;
RewriteRule ^getnew(&#91;0-9&#93;+).html$ search.php?do=getnew&f=$1 &#91;L&#93;
RewriteRule ^printthread(&#91;0-9&#93;+).html$ printthread.php?t=$1 &#91;L&#93;
RewriteRule ^sendthread(&#91;0-9&#93;+).html$ sendmessage.php?do=sendtofriend&t=$1 &#91;L&#93;
RewriteRule ^referthread(&#91;0-9&#93;+)-(&#91;0-9&#93;+).html$ showthread.php?t=$1&referrerid=$2 &#91;L&#93;
RewriteRule ^lastpostinthread(&#91;0-9&#93;+).html$ showthread.php?goto=lastpost&t=$1 &#91;L&#93;
RewriteRule ^newpostinthread(&#91;0-9&#93;+).html$ showthread.php?goto=newpost&t=$1 &#91;L&#93;
RewriteRule ^nextnewesttothread(&#91;0-9&#93;+).html$ showthread.php?t=$1&goto=nextnewest &#91;L&#93;
RewriteRule ^nextoldesttothread(&#91;0-9&#93;+).html$ showthread.php?t=$1&goto=nextoldest &#91;L&#93;
RewriteRule ^post(&#91;0-9&#93;+).html$ showthread.php?p=$1 &#91;L&#93;
RewriteRule ^post(&#91;0-9&#93;+)-(&#91;0-9&#93;+).html$ showpost.php?p=$1&postcount=$2 &#91;L&#93;
RewriteRule ^post(&#91;0-9&#93;+)-(&#91;0-9&#93;+)-(&#91;0-9&#93;+).html$ showthread.php?p=$1&page=$2&pp=$3 &#91;L&#93;
RewriteRule ^thread(&#91;0-9&#93;+)-(&#91;a-z&#93;+).html$ showthread.php?mode=$2&t=$1 &#91;L&#93;
RewriteRule ^post(&#91;0-9&#93;+)-(&#91;a-z&#93;+).html$ showthread.php?p=$1&mode=$2 &#91;L&#93;الان نذهب لملف includes/functions.php ونبحث عن التالي
</code> </code>

الان نذهب لملف includes/functions.php ونبحث عن التالي

رمز PHP:

<code style="white-space:nowrap"> <code> function print_output($vartext, $sendheader = 1)
{
global $pagestarttime, $query_count, $querytime, $DB_site, $bbuserinfo;
global $vbphrase, $vboptions, $stylevar, $_REQUEST;
</code> </code>

وضع بعدها

رمز PHP:

<code style="white-space:nowrap"> <code> // do Dani's Search Engine Optimization optimization
global $session;




$search_array = array(
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;sort=") . '(&#91;a-z&#93;*)' . preg_quote("&amp;order="). '(&#91;a-z&#93;*)' . preg_quote("&amp;pp=") . '(&#91;0-9&#93;*)' . preg_quote("&amp;daysprune="). '(&#91;^"&#93;*)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;daysprune=") . '(&#91;^"&#93;*)' . preg_quote("&amp;order=") . '(&#91;a-z&#93;*)' . preg_quote("&amp;sort=") . '(&#91;a-z&#93;*)' . preg_quote("&amp;pp=") . '(&#91;0-9&#93;*)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;daysprune=") . '(&#91;^"^&&#93;*)' . preg_quote("&amp;order=") . '(&#91;a-z&#93;*)' . preg_quote("&amp;sort=") . '(&#91;a-z&#93;*)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;daysprune="). '(&#91;^"^&&#93;*)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="forumdisplay.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;t=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;*)' . preg_quote("&amp;pp=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;t=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;t=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;goto=lastpost&amp;t =") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;goto=newpost&amp;t=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="printthread.php?$session&#91;sessionurl&#93;t=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="sendmessage.php?$session&#91;sessionurl&#93;do=sendtofrien d&amp;t=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;t=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;goto=next"). '(&#91;a-z&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;p=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;p=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;page=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;pp=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showpost.php?$session&#91;sessionurl&#93;p=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;postcount=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;mode=") . '(&#91;a-z&#93;+)' . preg_quote("&amp;t=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="showthread.php?$session&#91;sessionurl&#93;p=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;mode=") . '(&#91;a-z&#93;+)##',

'#<a (&#91;^>&#93;*)href' . preg_quote("="announcement.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;announcementid=") . '(&#91;0-9&#93;+)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="announcement.php?$session&#91;sessionurl&#93;f=") . '(&#91;0-9&#93;+)"#',

// sanitizing
'#<a (&#91;^>&#93;*)href="(&#91;^"&#93;*)&amp;page=(&#91;^"&#93;*).html"#',
'#<a (&#91;^>&#93;*)href="(&#91;^"&#93;*)&amp;highlight=(&#91;^"&#93;*).html"#',

// other
'#<a (&#91;^>&#93;*)href' . preg_quote("="search.php?$session&#91;sessionurl&#93;do=getdaily&amp;f=") . '(&#91;0-9&#93;*)"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="search.php?$session&#91;sessionurl&#93;do=getdaily") . '"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="search.php?$session&#91;sessionurl&#93;do=process&amp;replyles s=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childfor ums=1") . '"#',
'#<a (&#91;^>&#93;*)href' . preg_quote("="search.php?$session&#91;sessionurl&#93;do=process&amp;replyles s=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '(&#91;0-9&#93;+)' . preg_quote("&amp;childforums=1") . '"#'

);
$replace_array = array(
'<a 1href="forum2-3-4-5-6-7.html"',
'<a 1href="forum2-7-5-4-6-3.html"',
'<a 1href="forum2-3-4-5.html"',
'<a 1href="forum2-3.html"',
'<a 1href="forum2-3.html"',
'<a 1href="forum2.html"',
'<a 1href="thread2-3.html"',
'<a 1href="thread2-3.html"',
'<a 1href="thread2.html"',
'<a 1href="lastpostinthread2.html"',
'<a 1href="newpostinthread2.html"',
'<a 1href="printthread2.html"',
'<a 1href="sendthread2.html"',
'<a 1href="next3tothread2.html"',
'<a 1href="post2.html"',
'<a 1href="post2-3-4.html"',
'<a 1href="post2-3.html"',
'<a 1href="thread3-2.html"',
'<a 1href="post2-3.html#',

'<a 1href="announcement2-3.html"',
'<a 1href="announcement2.html"',

// sanitizing
'<a 1href="2-3.html"',
'<a 1href="2-3.html"',

// other
'<a 1href="getdaily2.html"',
'<a 1href="getdaily.html"',
'<a 1href="unanswered.html"',
'<a 1href="unanswered2.html"'

);
$vartext = preg_replace($search_array, $replace_array, $vartext);
</code> </code>

وبكذا تكون روابط منتداك تحولت لـ html




https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash4/482113_236967293114455_1193518507_n.png (http://www.dzbatna.com)
©المشاركات المنشورة تعبر عن وجهة نظر صاحبها فقط، ولا تُعبّر بأي شكل من الأشكال عن وجهة نظر إدارة المنتدى (http://www.dzbatna.com)©

استعمل مربع البحث في الاسفل لمزيد من المواضيع


سريع للبحث عن مواضيع في المنتدى