Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Professional Search Engine Optimization with PHP: A Developer''''s Guide to SEO doc
PREMIUM
Số trang
387
Kích thước
7.8 MB
Định dạng
PDF
Lượt xem
1952

Tài liệu Professional Search Engine Optimization with PHP: A Developer''''s Guide to SEO doc

Nội dung xem thử

Mô tả chi tiết

Professional

Search Engine

Optimization with PHP

A Developer’s Guide to SEO

Jaimie Sirovich

Cristian Darie

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page iii

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page ii

Professional

Search Engine

Optimization with PHP

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page i

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page ii

Professional

Search Engine

Optimization with PHP

A Developer’s Guide to SEO

Jaimie Sirovich

Cristian Darie

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page iii

Professional Search Engine Optimization with PHP:

A Developer’s Guide to SEO

Published by

Wiley Publishing, Inc.

10475 Crosspoint Boulevard

Indianapolis, IN 46256

www.wiley.com

Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-0-470-10092-9

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

Library of Congress Cataloging-in-Publication Data:

Sirovich, Jaimie, 1981-

Professional search engine optimization with PHP : a developer's guide to SEO / Jaimie Sirovich, Cristian Darie.

p. cm.

Includes index.

ISBN 978-0-470-10092-9 (pbk.)

1. PHP (Computer program language) 2. Web sites--Design. 3. Search engines. I. Darie, Cristian. II. Title.

QA76.73.P224S525 2007

005.13'3--dc22

2007003317

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by

any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under

Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the

Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center,

222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permis￾sion should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis,

IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO

REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE

CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT

LIMITATION WARRANTIES OF FITNESS FOR A PARTI CULAR PURPOSE. NO WARRANTY MAY BE CREATED

OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED

HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTAND￾ING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PRO￾FESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT

PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL

BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS

REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMA￾TION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE

ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READ￾ERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR

DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.

For general information on our other products and services please contact our Customer Care Department within

the United States at (800) 762-2974, outside the United States at (317) 572-3993

or fax (317) 572-4002.

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are

trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other

countries, and may not be used without written permission. Microsoft and Excel are registered trademarks of

Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their

respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be

available in electronic books.

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page iv

About the Authors

Jaimie Sirovich is a search engine marketing consultant. He works with his clients to build them power￾ful online presences. Officially Jaimie is a computer programmer, but he claims to enjoy marketing much

more. He graduated from Stevens Institute of Technology with a BS in Computer Science. He worked

under Barry Schwartz at RustyBrick, Inc., as lead programmer on e-commerce projects until 2005. At

present, Jaimie consults for several organizations and administrates the popular search engine market￾ing blog, SEOEgghead.com.

Cristian Darie is a software engineer with experience in a wide range of modern technologies, and the

author of numerous books and tutorials on AJAX, ASP.NET, PHP, SQL, and related areas. Cristian cur￾rently lives in Bucharest, Romania, studying distributed application architectures for his PhD. He’s get￾ting involved with various commercial and research projects, and when not planning to buy Google, he

enjoys his bit of social life. If you want to say “Hi,” you can reach Cristian through his personal web site

at http://www.cristiandarie.ro.

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page v

Credits

Acquisitions Editor

Kit Kemper

Developmental Editor

Kenyon Brown

Technical Editor

Bogdan Brinzarea

Production Editor

Angela Smith

Copy Editor

Kim Cofer

Editorial Manager

Mary Beth Wakefield

Production Manager

Tim Tate

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Joseph B. Wikert

Compositor

Laurie Stewart, Happenstance Type-O-Rama

Proofreader

Ian Golder

Indexer

Melanie Belkin

Anniversary Logo Design

Richard Pacifico

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page vi

Acknowledgments

The authors would like to thank the following people and companies, listed alphabetically, for their

invaluable assistance with the production of this book. Without their help, this book would not have

been possible in its current form.

Dan Kramer of Volatile Graphix for generously providing his cloaking database to the public — and even

adding some data to make our cloaking code examples work better.

Kim Krause Berg of The Usability Effect for providing assistance and insight where this book references

usability and accessibility topics.

MaxMind, Inc., for providing their free GeoLite geo-targeting data — making our geo-targeting code

examples possible.

Several authors of WordPress plugins including Arne Brachhold, Lester Chan, Peter Harkins, Matt Lloyd,

and Thomas McMahon.

Family and friends of both Jaimie and Cristian — for tolerating the endless trail of empty cans of

(caffeinated) soda left on the table while writing this book.

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page vii

00929ffirs.qxd:00929ffirs 3/13/07 10:36 AM Page viii

Contents

Acknowledgments vii

Introduction xvii

Chapter 1: You: Programmer and Search Engine Marketer 1

Who Are You? 2

What Do You Need to Learn? 3

SEO and the Site Architecture 4

SEO Cannot Be an Afterthought 5

Communicating Architectural Decisions 5

Architectural Minutiae Can Make or Break You 5

Preparing Your Playground 6

Installing XAMPP 7

Preparing the Working Folder 8

Preparing the Database 11

Summary 12

Chapter 2: A Primer in Basic SEO 13

Introduction to SEO 13

Link Equity 14

Google PageRank 15

A Word on Usability and Accessibility 16

Search Engine Ranking Factors 17

On-Page Factors 17

Visible On-Page Factors 18

Invisible On-Page Factors 20

Time-Based Factors 21

External Factors 22

Potential Search Engine Penalties 26

The Google “Sandbox Effect” 26

The Expired Domain Penalty 26

Duplicate Content Penalty 27

The Google Supplemental Index 27

Resources and Tools 28

Web Analytics 28

00929ftoc.qxd:00929ftoc 3/13/07 2:02 PM Page ix

x

Contents

Market Research 29

Researching Keywords 32

Browser Plugins 33

Community Forums 33

Search Engine Blogs and Resources 34

Summary 35

Chapter 3: Provocative SE-Friendly URLs 37

Why Do URLs Matter? 38

Static URLs and Dynamic URLs 38

Static URLs 39

Dynamic URLs 39

URLs and CTR 40

URLs and Duplicate Content 41

URLs of the Real World 42

Example #1: Dynamic URLs 42

Example #2: Numeric Rewritten URLs 43

Example #3: Keyword-Rich Rewritten URLs 44

Maintaining URL Consistency 44

URL Rewriting 46

Installing mod_rewrite 48

Testing mod_rewrite 49

Introducing Regular Expressions 54

URL Rewriting and PHP 60

Rewriting Numeric URLs with Two Parameters 61

Rewriting Keyword-Rich URLs 64

Building a Link Factory 66

Pagination and URL Rewriting 72

Rewriting Images and Streaming Media 72

Problems Rewriting Doesn’t Solve 75

A Last Word of Caution 75

Summary 76

Chapter 4: Content Relocation and HTTP Status Codes 77

HTTP Status Codes 78

Redirection Using 301 and 302 79

301 81

302 82

Removing Deleted Pages Using 404 83

Avoiding Indexing Error Pages Using 500 84

00929ftoc.qxd:00929ftoc 3/13/07 2:02 PM Page x

xi

Contents

Redirecting with PHP and mod_rewrite 84

Using Redirects to Change File Names 85

URL Correction 89

Dealing with Multiple Domain Names Properly 90

Using Redirects to Change Domain Names 90

URL Canonicalization: www.example.com versus example.com 91

URL Canonicalization: /index.php versus / 92

Other Types of Redirects 94

Summary 94

Chapter 5: Duplicate Content 95

Causes and Effects of Duplicate Content 96

Duplicate Content as a Result of Site Architecture 96

Duplicate Content as a Result of Content Theft 96

Excluding Duplicate Content 97

Using the Robots Meta Tag 97

robots.txt Pattern Exclusion 99

Solutions for Commonly Duplicated Pages 103

Print-Friendly Pages 103

Navigation Links and Breadcrumb Navigation 104

Similar Pages 106

Pages with Duplicate Meta Tag or Title Values 106

URL Canonicalization 106

URL-Based Session IDs 107

Other Navigational Link Parameters 107

Affiliate Pages 108

Redirecting Parameterized Affiliate URLs 109

Summary 118

Chapter 6: SE-Friendly HTML and JavaScript 119

Overall Architecture 120

Search Engine–Friendly JavaScript 120

JavaScript Links 121

DHTML Menus 121

Popup Windows 121

DHTML Popup Windows 129

Crawlable Images and Graphical Text 129

Search Engine–Friendly HTML 140

HTML Structural Elements 141

Copy Prominence and Tables 141

00929ftoc.qxd:00929ftoc 3/13/07 2:02 PM Page xi

xii

Contents

Frames 144

Using Forms 144

Using a Custom Markup Language to Generate SE-Friendly HTML 145

Flash and AJAX 149

The Blended Approach 149

Summary 150

Chapter 7: Web Feeds and Social Bookmarking 151

Web Feeds 151

RSS and Atom 152

Creating RSS Feeds 154

Syndicating RSS and Atom Feeds 160

Other Sources of Syndicated Content 164

Social Bookmarking 164

Summary 172

Chapter 8: Black Hat SEO 173

What’s with All the Hats? 174

Bending the Rules 175

Technical Analysis of Black-Hat Techniques 176

Attack Avoidance 177

HTML Insertion Attacks 177

Avoiding Comment Attacks Using Nofollow 180

Sanitizing User Input 184

Requesting Human Input 188

301 Redirect Attacks 194

Content Theft 196

On Buying Links 197

Digital Point Co-op, Link Vault 197

Summary 197

Chapter 9: Sitemaps 199

Traditional Sitemaps 199

Search Engine Sitemaps 200

Using Google Sitemaps 201

Using Yahoo! Sitemaps 203

Generating Sitemaps Programmatically 203

Informing Google about Updates 208

00929ftoc.qxd:00929ftoc 3/13/07 2:02 PM Page xii

Tải ngay đi em, còn do dự, trời tối mất!