動的ページのSEO対策には、主に2つの方法があります。
1.静的化(本当の静的ページを生成する)
2.擬似静的化(URLを静的ページのように見せかける)
まずは静的化(PHP)について。方法論ですが、テンプレートを利用することで、静的ページに変換することができます。
HTMLテンプレートソース(temp.html)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{ title }</title>
</head>
<body>
this is a { file } file's templets
</body>
</html>
<?php
$title = "http://export-japan.com";
$file = "zucoco";
$fp = fopen ("temp.html","r");
$content = fread ($fp,filesize ("temp.html"));
$content = str_replace ("{file}",$file,$content);
$content = str_replace ("{title}",$title,$content);
// echo $content;
$filename = "test/test.html";
$handle = fopen ($filename,"w"); //静的ファイルを生成する
if (!is_writable ($filename)){
die ("ファイル:".$filename."書き込みができません。");
}
if (!fwrite ($handle,$content)){ //データをテンプに挿入する
die ("ファイル生成".$filename."失敗");
}
fclose ($handle);
?>
view:350





