imlovephoto

บริการถ่ายภาพแต่งงาน Pre-Wedding ถ่ายภาพนอกสถานที่ ถ่ายภาพในสตูดิโอ สามารถเลือกสถานที่ได้ ถ่ายด้วยกล้องดิจิตอล และถ่ายวีดีโอภายในงาน รับถ่ายรูปรับปริญญา รูปงานสำคัญต่างๆ ถ่ายภาพเดี่ยว ครอบครัว แฟชั่น

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

สวัสดีครับ ยินดีรับใช้ เนื้อหา สารน่ารู้ เกี่ยวกับเทคโนโลยี

imlovezaa
รายละเอียด
บริการถ่ายภาพแต่งงาน Pre-Wedding ถ่ายภาพนอกสถานที่ ถ่ายภาพในสตูดิโอ สามารถเลือกสถานที่ได้ ถ่ายด้วยกล้องดิจิตอล และถ่ายวีดีโอภายในงาน
รับถ่ายรูปรับปริญญา รูปงานสำคัญต่างๆ ถ่ายภาพเดี่ยว ครอบครัว แฟชั่น

15/2/59

XAMPP ในระบบปฏิบัติการ Windows 7

วิธีทำ Virtual Host บน XAMPP ในระบบปฏิบัติการ Windows 7




ข้อมูลทั้งหมดนี้มาจาก http://share.olanlab.com/th/it/blog/view/142

Virtual Host คืออะไร ?

Virtual Host คือ การทำให้ Server เครื่องเดียวสามารถให้บริการได้มากกว่า 1 เว็บไซต์ ซึ่งโดยปกติสามารถให้บริการได้เพียงเว็บไซต์เดียว การทำ Virtual Host สามารถทำได้หลายวิธี ดังนี้
  1. Name-based Virtual Host - การอ้างอิงโดยใช้ Domain Name หรือ Host Name
  2. Port-based Virtual Host - การอ้างอิงโดยใช้ Port Number
  3. IP-based Virutal Host - การอ้างอิงโดยใช้ IP Address
  4. การใช้ทั้ง Port-based ร่วมกับ IP-based
  5. การใช้ทั้ง Name-based ร่วมกับ IP-based

เริ่มต้นการทำ Virtual Host แบบ Step By Step

การทำ Virtual Host บน XAMPP ในระบบปฏิบัติการ Window 7 ต้องแก้ไขไฟล์ดังนี้

  • httpd-vhosts.conf
  • hosts

ขั้นตอนที่ 1 แก้ไข httpd-vhosts.conf

ไปที่ C:\xampp\apache\conf\extra\httpd-vhosts.conf เปิดไฟล์ขึ้นมา หาคำว่า NameVirtualHost แก้ไขให้เป็น
NameVirtualHost *:80
กำหนด Virtual Host ของ localhost เพื่อให้สามารถใช้ localhost ได้เหมือนเดิม

    DocumentRoot c:/xampp/htdocs
    ServerName localhost
    
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Deny,Allow
        Allow from all
    


ต่อมาทำการเพิ่มชื่อ Domain Name หรือ Host Name เพื่ออ้างอิงไปยัง Path ที่เก็บเว็บไซต์ที่ต้องการและกำหนดสิทธิ์การเข้าถึง

    DocumentRoot c:/xampp/htdocs/share/public
    ServerName share.olanlab.com
    
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Deny,Allow
        Allow from all
    

ตัวอย่างด้านบน
Path ที่เก็บเว็บไซต์เป็น - c:/xamp/htdocs/share/public
Domain Name เป็น     - share.olanlab.com

ขั้นตอนที่ 2 แก้ไข hosts 

ไปที่ C:\Windows\System32\drivers\etc\hosts เปิดไฟล์ขึ้นมาทำการเพิ่ม Host Name และ IP Address  เพื่อให้เครื่องของเรารู้จักชื่อ Host Name นี้ว่าจะต้องไปที่ IP Adress อะไร
127.0.0.1       localhost
127.0.0.1       share.olanlab.com
*ไฟล์ hosts ทำหน้าที่เก็บข้อมูล Host Name กับ IP Address ที่ตรงกัน

ขั้นตอนที่ 3 ทำการ Restart Apache

ขั้นตอนสุดท้ายคือการ Restart Apache เพื่อให้ Apache ทำการโหลดค่าที่เรากำหนดใน httpd-vhosts.conf ใหม่เท่านี้ก็สามารถใช้ Virtual Host บน XAMPP ในระบบปฏิบัติการ Window 7 ได้แล้วครับ

redirect เว็บไซด์ด้วย .htaccess

RewriteEngine On #เปิดการใช้งาน mod rewrite
RewriteCond %{SERVER_PORT} 80  #ใช้เช็ค พอร์ต
RewriteCond %{HTTP_HOST} !^www\.colo\.in\.th$ [NC] #ใช้เช็ค dns
RewriteCond %{REQUEST_URI} somefolder #ใช้เช็ค path ที่เข้ามา
RewriteRule ^(.*)$ http://www.colo.in.th/$1 [L,R=301] #ใช้สำหรับการคืนค่า
*** หมายเหตุ *** ถ้ามีมากกว่าหนึ่ง พอร์ต ใช้ [OR] เพื่อเชื่อม
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} !^www\.colo\.in\th$ [NC]
RewriteRule ^(.*)$ https://www.colo.in.th/$1 [L,R=301]
//—————————————————————————————-
มาจาก http://support.howhost.com/entries/271311-redirect-htaccess
ตัวอย่างต้นฉบับ
เอกสารนี้จะช่วยอธิบายวิธีการสร้างไฟล์ .htaccess เพื่อทำการ redirect หน้าเว็บไซด์ของคุณ
1. สร้าง Textfile เปล่าด้วย Text Editor เช่น Notepad และทำการ Save as เป็นชื่อ htaccess.txt
2. ทำการแก้ไขไฟล์ htaccess.txt
Redirect ทั้งหน้าเว็บเพ็จไปยัง URL อื่น
Redirect 301 / http://support.colo.in.th/
Redirect index.html ไปยัง Sub Folder ที่ต้องการ
Redirect /index.html http://colo.in.th/newdirectory/
Redirect ไฟล์เก่า ไปยังไฟล์ใหม่
Redirect /olddirectory/oldfile.htmlhttp://colo.in.th/newdirectory/newfile.html
Redirect ไปยังหน้า Index ที่ต้องการ
DirectoryIndex index.html
Redirect User ให้เข้าเว็บไซด์โดยไม่ให้มี www นำหน้า
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.colo\.in\.th$ [NC]
RewriteRule ^(.*)$ http://colo.in.th/$1 [L,R=301]
Redirect User ให้เข้าเว็บไซด์โดยบังคับให้มี www นำหน้า
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.colo\.in\.th$ [NC]
RewriteRule ^(.*)$ http://www.colo.in.th/$1 [L,R=301]
Redirect User เพิ่อให้บังคับใช้ SSL
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.colo.in.th/$1 [R,L]
Redirect User สำหรับใช้ www ที่เป็น http:// และ https://
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} !^www\.colo\.in.\th$ [NC]
RewriteRule ^(.*)$ http://www.colo.in.th/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} !^www\.colo\.in.\th$ [NC]
RewriteRule ^(.*)$ https://www.colo.in.th/$1 [L,R=301]
Redirect User เพื่ิอบังคับใช้ https:// ในบาง Folder
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://www.colo.in.th/somefolder/$1 [R,L]
3. ทำการ Upload File ไปยัง server ของคุณโดยให้ทำการ Rename ชื่อไฟล์ไปเป็น .htaccess



ขอบคุณ http://9yai.wordpress.com
https://support.hostatom.com/knowledgebase.php?action=displayarticle&id=190