0

Comments

1
2
3
4
5
6
7
8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^index\.html$ index.php
RewriteRule ^login\.html$ login.php
RewriteRule ^register\.html$ register.php
</IfModule>

ตัวอย่าง PHPWind
ปกติเป็น http://www.i7forums.com/index.php เมื่อใส่โค้ดนี้ลงในไฟล์ .htaccess อัพขึ้นโฮสต์แล้วรัน http://www.i7forums.com/index.html ได้ไม่มีปัญหา ที่สำคัญ SEO Work แน่นอน

< ,,,, >
0

Comments

404 Page Not Found ที่เห็นกันบ่อยๆ บางรู้ยังไม่รู้ว่ามันคืออะไร บางคนรู้แล้วแต่อธิบายไม่ถูก มันคือคำศัพท์ทางคอมพ์ เมื่อใช้โปรแกรมบราวเซอร์เข้าไป URL ที่ไม่มีจริงๆ ก็จะแสดงข้อมูลนี้คือมาให้เราเห็นทันที แต่ผมไม่อยากให้ใครบางคนเข้าไปยัง URL ที่ถูกลบไปแล้วหรือไม่มีจริง ผมไม่อยากให้มันโชว์หน้าขาวเพราะดูแล้วมันไม่ค่อยสวยเท่าไหร่ ก่อนอื่นเราต้องสร้างไฟล์ HTML ขึ้นมาก่อน 1 ไฟล์ใส่ชื่อเป็น 404.htm ครับเพราะจำงายดีและไฟล์ html รันได้เร็ว ใส่ Style Css ง่ายผมเลยเลือกใช้ไฟล์นี้ กรณีบทความนี้ผมเขียน html ให้แล้วและคิดว่ามันก็คงจะสวยถูกใจใครบางคนก็ได้ ดาวน์โหลดเลยครับ >>
ดาวน์โหลด 404 Page Not Found.zip
อัพโหลดขึ้นโฮสต์ สร้างไฟล์ .htaccess ใส่โค้ดนี้ลงไป

1
2
3
4
5
6
<ifmodule mod_rewrite.c>
RewriteEngine On 
ErrorDocument 404 http://www.โดเมนคุณ.com/404.htm
ErrorDocument 403 http://www.โดเมนคุณ.com/404.htm
ErrorDocument 500 http://www.โดเมนคุณ.com/404.htm
</ifmodule>

ปรับแต่งไฟล์ 404.htm หน่อย วางโค้ดนี้ใต้ส่วน head

1
<meta http-equiv="refresh" content="4;url=http://www.i7forums.com/"/>

Read the rest of this entry »

0

Comments

นี่คือ subdomain : http://blog.pwblog.net/ นี่คือโดเมนปกติ http://www.pwblog.net/blog กรณีที่เราสร้าง Subdomain ขึ้นมา 1 ชื่อเราสามารถที่จะเข้า ได้ทาง Subdomain หรือทางโดเมนปกติก็ได้ตามตัวอย่างด้านบน แต่ถ้าเราไม่อนุญาติให้เข้าทางโดเมนปกติหละ อย่างเช่นผมไม่อยากให้เข้าทางนี้ http://www.pwblog.net/blog เมื่อคลิกที่ลิงก์นี้ http://www.pwblog.net/blog ระบบจะ rewriting ไปยัง http://blog.pwblog.net/ ทันที ข้อดีคือ SEO ครับ-*- อ่านเพิ่มเติม สร้างไฟล์ PHP ขึ้นมา 1 ไฟล์ใส่ชื่อเป็น 301.php ชื่อจำง่ายดี ใส่โค้ดนี้ลงไป

1
2
3
4
5
6
7
8
9
10
<?php
$a=$_SERVER['URL'];
$a=substr($a,4);
$b=$db_bbsurl;
$url = str_replace("www", "บล็อก", "$b");
//echo $url;
$url=substr($url, 0,-4);
$c=$url.$a;
header("location:http://บล็อก.โดเมนคุณ.com$c");
?>

บล็อก คือชื่อ Subdomain

บันทึกเป็นไฟล์ ชื่อ 301.php อัพโหลดขึ้น Hosting
การใช้งานก็แค่ include เข้าไปในไฟล์ index.php ของ Subdomain ที่คุณต้องการให้ rewriting

1
<?php include("301.php"); //301.php หรือชื่ออื่น ?>
< ,,,, >
0

Comments

รูปแบบ CSS เป็น CSS3 ครับผสมผสานกับรูปภาพไอคอนที่หาได้ ดูดีมีสไตล์ไปอีกแบบ สามารถนำไปประยุคใช้แบบง่ายๆ ก่อนอื่นต้องสร้าง CSS ก่อนเก็บไว้ที่ไฟล์ style.css แต่ในที่นี้ผมใผมเขียน css แบบฝังนะครับ จะฝังโค้ดไว้ที่ไฟล์ html เลยจะได้เรียกใช้งานง่าย กรณีตั้วอย่างเท่านั้น
โค้ด CSS แบบแยก

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
body{
	font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; 
	font-size:11px;
}
a.button{
	background:url(img/button.gif);
	display:block;
	color:#555555;
	font-weight:bold;
	height:30px;
	line-height:29px;
	margin-bottom:14px;
	text-decoration:none;
	width:191px;
}
a:hover.button{
	color:#0066CC;
}
 
/* -------------------- */
/* CLASSES				*/
/* -------------------- */
	.add{
		background:url(img/add.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.delete{
		background:url(img/delete.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.user{
		background:url(img/user.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.alert{
		background:url(img/alert.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.msg{
		background:url(img/msg.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.download{
		background:url(img/download.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
 
	.lens{
		background:url(img/lens.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}
	.info{
		background:url(img/info.gif) no-repeat 10px 8px;
		text-indent:30px;
		display:block;
	}

ตัวอย่างโค้ด HTML
Read the rest of this entry »

< , >
0

Comments

สร้างไฟล์ .htaccess มาแล้วใสโค้ดนี้ลงไป

1
2
3
4
5
6
7
<IfModule mod_rewrite.c>
RewriteEngine on
<Files ~ "^(.*)\.(htm|sql)$">
  Order deny,allow
  Deny from all
</Files>
</IfModule>

ทดสอบได้ที่ http://www.i7forums.com/template/wind/index.htm เมื่อคุณเข้าไปลิงก์นี้มันจะ Redirect ไปยังหน้า 404.php ทันที
โค้ดเพิ่มเติม

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^i7forums.com [NC] 
RewriteRule ^(.*)$ http://www.i7forums.com/$1 [L,R=301] 
 
ErrorDocument 404 http://www.i7forums.com/404.php
ErrorDocument 403 http://www.i7forums.com/404.php
ErrorDocument 500 http://www.i7forums.com/404.php
 
<Files ~ "^(.*)\.(htm|sql)$">
  Order deny,allow
  Deny from all
</Files>
</IfModule>
< >