Skip to content

Instantly share code, notes, and snippets.

@chobie
Created December 1, 2010 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chobie/723740 to your computer and use it in GitHub Desktop.
Save chobie/723740 to your computer and use it in GitHub Desktop.
... .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*\.html)$ file.php?target=$1 [QSA,L]
#敢えてファイルが存在するときで、末尾に.htmlが付くファイルの場合のみリライトさせる
</IfModule>
... file.php
<?php
//エラーチェック手抜きです><
if(!isset($_REQUEST['target']){
header(404);
exit;
}
ob_start();
include $_REQUEST['target'];
$data = ob_get_clean();
// output filtering...
echo $data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment