หัวข้อ: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 11:52:38 ตามหัวข้่อเลยครับ
อยากรู้ว่า browser สามารถ block การ redirect แบบนี้ได้มั้ยครับ ถ้าได้ งั้นผมขอวิธี redirect ที่ได้ผล 100% ด้วยนะครับ :-* ขอบคุณครับ หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 12:00:59 ตามหลัก บล็อกไม่ได้ครับ เพราะเป็นคำขอเปลี่ยน location
จึงไม่มี refer หรืออะไีรให้ตรวจ แต่ถ้ามีเงื่อนไขอื่นประกอบ ก็สามารถทำได้ในบางเคส (ตรงนี้ไม่ขอพูด) สรุปคือยังไง มันบล็อกไม่ได้ครับ :) หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 12:03:56 ขอบคุณครับ
สรุปคือผมสามารถมั่นใจได้ 100% เลยใช่มั้ยครับว่า user ของผมจะไปถึงยังหน้าปลายทางแน่นอนครับ หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 12:09:03 ใช่ครับ เพราะคำสั่งนี้ มีผลกับ browser โดยตรง
avatar ผมก็ใช้ header location เหมือนกัน สุ่ม array แล้วค่อย location ไปเว็บฝากรูป เหตุเพราะไม่อยากเปลืองแบนวิท :D หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 12:41:10 ขออีกคำถามครับ
แล้วถ้าจะ redirect โดย pass referrer ไปด้วยนั้นสามารถทำได้มั้ยครับ :'( หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 13:12:35 ขออีกคำถามครับ แล้วถ้าจะ redirect โดย pass referrer ไปด้วยนั้นสามารถทำได้มั้ยครับ :'( ไม่เก็ทครับ หมายถึงยังไงเหรอ ??? หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 13:47:47 ขออีกคำถามครับ แล้วถ้าจะ redirect โดย pass referrer ไปด้วยนั้นสามารถทำได้มั้ยครับ :'( ไม่เก็ทครับ หมายถึงยังไงเหรอ ??? ปกติเวลาเรา request ไปที่ server มันจะมี header ที่ชื่อว่า referrer ใช่มั้ยครับ ถ้าเป็น php จะใช้ $_SERVER['HTTP_REFERER'] ในการดูค่าครับ แต่ทีนี้ถ้าสมมุติผมส่ง user ไปหน้า A user คลิกลิงค์ในหน้า A ไป B ณ ขณะนั้นถ้า B จะได้ค่า referrer มาค่านึงคือ A แตุ่ถ้าหน้า B ทำการ redirect ไปหน้า C นั้น referrer จะไม่ส่งตามไปด้วยอะครับ หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: GAPZiNE ที่ 18 กันยายน 2008, 16:42:37 :'(
หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 17:16:38 มีทางคือ หน้า2 ต้องทำอย่างอื่นที่ไม่ใช่ header location เช่น
โค๊ด: <script>window.location="3.php";</script> :) หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 17:22:43 มีทางคือ หน้า2 ต้องทำอย่างอื่นที่ไม่ใช่ header location เช่น โค๊ด: <script>window.location="3.php";</script> :) ขอบคุณครับ แต่ว่าถ้ากรณีที่ user คนไหนปิดการ run java script ของ browser ไว้ก็จะไม่ไปถึงปลายทางได้ เฮ้อ... ได้อย่างก็ต้องเสียอย่าง :-X หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 17:24:18 ทุกอย่างมีทางเลือกเสมอ (ฮา)
โค๊ด: <meta http-equiv="refresh" content="0;URL=3.php" /> :D :D หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 17:31:34 ทุกอย่างมีทางเลือกเสมอ (ฮา) โค๊ด: <meta http-equiv="refresh" content="0;URL=3.php" /> :D :D แล้วถ้าอย่างนี้หล่ะครับจะใช้ได้ทุก browser มั้ยครับ (เท่าที่รู้คิดว่าไม่อะครับ :o) หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 18 กันยายน 2008, 17:32:55 ได้สิครับ ยกเว้น browser ไม่รองรับ html เลย
:P (โค้ดนี้สร้างจาก dreamweaver) หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: hikizume ที่ 18 กันยายน 2008, 17:36:31 ขอบคุณอีกครั้งนะครับคุณ EThaiZone ที่ช่วยตอบครับ
:) หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: chedsada ที่ 18 กันยายน 2008, 18:38:22 เข้ามางงครับ ขอถามต่อละกัน
redirect เพื่ออะไรครับ แล้วทำไปทำไม แล้ว referer นี่ื่คืออะไร ทำไมต้องมี referer ด้วย ถ้าไม่มีแล้วจะส่งผลยังไง ในเมื่อเรามีเว็บของเราอยู่แล้วทำไมเราไม่ใช้เว็บเราเลยล่ะ งงจริงๆครับ ช่วยอธิบายให้กระจ่างทีครับ หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: EThaiZone ที่ 23 กันยายน 2008, 08:53:03 เข้ามางงครับ ขอถามต่อละกัน redirect ใช้ส่งต่อการแสดงผลไปยังหน้าอื่น อันนี้แล้วแต่กรณีคนทำว่าเขาใช้ทำเพื่ออะไีรredirect เพื่ออะไรครับ แล้วทำไปทำไม แล้ว referer นี่ื่คืออะไร ทำไมต้องมี referer ด้วย ถ้าไม่มีแล้วจะส่งผลยังไง ในเมื่อเรามีเว็บของเราอยู่แล้วทำไมเราไม่ใช้เว็บเราเลยล่ะ งงจริงๆครับ ช่วยอธิบายให้กระจ่างทีครับ ส่วน referer เป็นค่าที่ตัว browser จะส่งไปยังเว็บ เพื่อบอกว่า หน้านี้ หรือไฟลฺนี้ ได้มีการเข้ามาทางหน้าเว็บไหน ซึ่งช่วยให้เราสามารถระบุที่มาต้นทางได้ รวมถึงใช้ป้องกันได้ เช่น การตรวจ referer เมื่อมีการเรียกรูปภาพเพื่อป้องกันการ hotlink ูู^^" หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: Fly2BlueSky ที่ 23 กันยายน 2008, 08:57:14 ;) ได้ความรู้เยอะดีแฮะ
หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: tinnoi ที่ 23 กันยายน 2008, 19:42:20 ขอบคุณมากครับ แต่มาขอถามเพิ่มนิดนึงตรง
โค๊ด: <meta http-equiv="refresh" content="0;URL=3.php" /> แบบนี้ถือเป็น redirect แบบ 301 ไหมครับ หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: Legendary Pon ที่ 23 กันยายน 2008, 21:34:09 ขอบคุณมากครับ แต่มาขอถามเพิ่มนิดนึงตรง โค๊ด: <meta http-equiv="refresh" content="0;URL=3.php" /> แบบนี้ถือเป็น redirect แบบ 301 ไหมครับ ไม่ครับ แล้วถ้าอยากรู้ว่าเพจไหน status เป็นอย่างไร เช็คด้วยเวบนี้นะครับ http://www.seoconsultants.com/tools/headers.asp หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: Backmoney ที่ 23 กันยายน 2008, 21:36:44 เกิดสงสัย ถ้าใช้ redirect ไม่ดีจะกลายเป็น Doorway ใช่ป่ะคับ
หัวข้อ: Re: การ redirect โดย php header("Location: url"); นั้นสามารถทำได้ทุก browser มั้ย? เริ่มหัวข้อโดย: visavavit ที่ 23 กันยายน 2008, 21:38:06 301 redirect
อ้างถึง IIS Redirect * In internet services manager, right click on the file or folder you wish to redirect * Select the radio titled "a redirection to a URL". * Enter the redirection page * Check "The exact url entered above" and the "A permanent redirection for this resource" * Click on 'Apply' ColdFusion Redirect <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="[url]http://www.new-url.com[/url]"> PHP Redirect <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: [url]http://www.new-url.com[/url]" ); ?> ASP Redirect <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","[url]http://www.new-url.com/[/url]" %> ASP .NET Redirect <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","[url]http://www.new-url.com[/url]"); } </script> JSP (Java) Redirect <% response.setStatus(301); response.setHeader( "Location", "[url]http://www.new-url.com/[/url]" ); response.setHeader( "Connection", "close" ); %> CGI PERL Redirect $q = new CGI; print $q->redirect("[url]http://www.new-url.com/[/url]"); Ruby on Rails Redirect def old_action headers["Status"] = "301 Moved Permanently" redirect_to "[url]http://www.new-url.com/[/url]" end Redirect Old domain to New domain (htaccess redirect) Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain. The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed) Options +FollowSymLinks RewriteEngine on RewriteRule (.*) [url]http://www.newdomain.com/[/url]$1 [R=301,L] Please REPLACE [url=http://www.newdomain.com]www.newdomain.com[/url] in the above code with your actual domain name. In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website. Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled. Redirect to www (htaccess redirect) Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to [url=http://www.domain.com]www.domain.com[/url] The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed) Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ [url]http://www.domain.com/[/url]$1 [r=301,nc] Please REPLACE domain.com and [url=http://www.newdomain.com]www.newdomain.com[/url] with your actual domain name. Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled. |