Admin

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Đây là demo
Tạo file .htaccess nếu có rồi thì thôi, sau đó dán nội dung này vào:
PHP:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*).(html|xhtml|xml)$ /index.php?file=$1.$2 [L]

ErrorDocument 404 http://tuoitreit.vn
ErrorDocument 404 http://tuoitreit.vn
ErrorDocument 500 http://tuoitreit.vn

Tiếp file index.php dán code này vào:
PHP:
<?php
error_reporting(0);
$url = $_GET['file'];
$head = 'phần head';
$foot = 'phần foot';
if(file_exists($url)){
$url = file_get_contents($url);
$url = str_replace('<body>', '<body>'.$head, $url);
$url = str_replace('</body>', $foot.'</body>', $url);
echo $url;
}else{
$url = file_get_contents('index.html');
$url = str_replace('<body>', '<body>'.$head, $url);
$url = str_replace('</body>', $foot.'</body>', $url);
echo $url;
}
?>
 
Cho ? Vs thớt
vd: yourdomain.com/download
vậy trong mục dowload cũng phải chèn file .htaccess và thêm đoạn php kia vào indẽx của mục ư
 
Cho ? Vs thớt
vd: yourdomain.com/download
vậy trong mục dowload cũng phải chèn file .htaccess và thêm đoạn php kia vào indẽx của mục ư

uk vi no chi co tac dung trong thu muc chua no thoi :D minh doan the
 

Facebook Comments

Similar threads

H
Replies
8
Views
2K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
2K
AdminAdmin is verified member.
Admin
Back
Top