WebProWorld Dev Forum

Slow FTP connection & occasional "time out"
On Friday last week I uploaded a website via ftp for a customer. The connection was fast and I did all the necessary configuring without any problems at all. The site is running perfectly.
Click to read more...

A little help with inadvertant shutdown
I am currently working on a HP 742C home PC. The problem is it shuts down either durring startup or minutes after startup. I tried Removing the PCI cards...
Click to read more...

Internet Problems
I recently reformatted my computer, I now have all the default files, except from a few programs and stuff, but I am having a problem with the internet.
Click to read more...



Recent Articles

Should You Renew With Your Current Host?
Sometime during this year the chances are you're going to have to renew your hosting package. Can you be sure you're still getting the best deal for your site?

Web Hosting: 4 Factors in Choosing a Hosting Company
When choosing a web hosting company there are a whole lot of different factors that should go into your decision making process.

PHP and Cookies; a Good Mix!
Cookies have long been used in PHP scripts, and are a very useful function. But what exactly are cookies? Maybe you have used then, but you still don't know exactly what they are. Or you are completely new to cookies?

PHP to HTML – Getting Dynamic Pages Indexed
Most will agree Php has become the common language for creating dynamic Websites. Although the language is simple and efficient, developers are finding trouble getting traffic to their Php site.

Do-It-Yourself Usability Testing: Your Questions Answered
So, if you have followed all of our Usability articles, outlining how to create useful content, layout, and navigation, then you may feel your website is set and ready and usable.

Website Content Usability
In recent articles we have discussed the importance of layout and navigation in creating a website with a high usability rating. However, all the best navigation in the world will do you no good if your visitors are navigating around bad content.

Developing Your Site for Performance : Compression and Other Server-Side Enhancements
This is the fifth part of a five part article. Read part four here. While our twenty tips for code optimization in Part I began with the developer's source code, our discussion of cache control in Part II led us steadily towards the server-side in our quest for maximum Web site performance.

Developing Your Site for Performance : Optimal Cache Control
Now that our code has been optimized in order to send as little data as possible, in Part II, we will focus primarily on sending that data as infrequently as possible by means of better utilization of caching on the Web.

02.09.05


Get PHP Pages Indexed In The Search Engines

By Michael Medeiros

A simple method to convert files from Php to Html Extensions, on an Apache Server

Most will agree Php has become the common language for creating dynamic Websites. Although the language is simple and efficient, developers are finding trouble getting traffic to their Php site. It is believed by many educated Search Engine Optimization Specialists that spiders do not read beyond the, ".php," on a URL. Therefore, dynamic pages that pass a variable will be overlooked. For example, on a PHP directory, variables may be passed to a file as, "index.php?category=x". In this instance, the category specified as "x" will not be read or indexed by Search Engines. Spiders will open the parent page (index.php). This is supported by the belief that nothing is read beyond the "?", thus making all category links, "index.php".

While many dynamic Websites still receive modest traffic, it may be in a developers' best interest to allow some, or all, dynamic pages to be seen as well. Having two pages indexed may not double a sites' traffic, but it will ensure a noticeable increase. Developers' can easily overcome this problem, if their Site resides on an Apache Server.

This simple fix will satisfy the problem for a simple script, as in the example above, where one or more Php files are passed variables to perform different functions. Bare in mind, if a Php file only performs one task, this is not required. Files that perform a task without the "?variable=x" being required will be indexed. Therefore, it would be useless to transform them to a Static URL (HTML File).

Identify the Php File Needing to be changed to an Html

First, identify the desired file, or files, that require the change, along with the variables that generate a common page. Generally, this may be, "index.php". To help readers follow along, I am going to utilize the above Directory example. On our Directory program, we have a main page, "index.php," which always displays links to Subdirectories. The subdirectories are opened by passing a variable to the index file. For example, a subcategory called, "Arts and Crafts," is displayed with, "index.php?category=1". Additional subcategories are displayed with an identical syntax, but the end variable changes. Because of this, we need to modify the way our server opens the index.php file, when a variable is attached.

Next, we need to place a simple .htaccess file in the directory where, "index.php," is located on the server. The .htaccess file is a simple text file that we name .htaccess. Vdeck users may need to create a file named something.txt, and then rename the file to .htaccess, from the admin panel. Now we need to specify some variables to the server. For this example, I am going to change the, "?category=x," variable to, "directory-x.html". This step will eliminate our problem of having the subcategories noticed by Search Engine Spiders.

Get real-time visibility and control of Microsoft web application service levels with the VIEO management appliance -> more info

To start our server variables, we need to create a rewrite engine in the .htaccess file. Simply put our first line will read, "RewriteEngine On". This tells the server we are changing the way certain files are to be handled. No we need to specify our Rewrite rule. On the next line, "RewriteRule ^directory-([0-9]*).* index.php?category=$1 [L,NC],". This is delegating, "requests to this directory, where the file is named, "directory-," followed by a range of 0 to 9, followed by anything (* = Wildcard) and, "dot," anything (* = Wildcard), we are going to display, "index.php," file with the variable attached. We can create another rewrite rule on another line of our .htaccess file. However, a meticulous developer likes to test things out before making changes to the actual Php file, or progressing ahead of oneself. We can test our, "RewriteRule," by opening another browser window and entering, "directory-1.htm or directory-1.html," into the address bar. We should see the same page displayed as, "index.php?category=1," is called.

Finally, we want the Search Engine spiders to be able to see our shinning new readable URL that can be indexed. Rather than scurrying around to every search engine and submitting the URL, we are going to open up our Php file for editing. Before this is done, make a copy of each script that is going to be modified. Save the copy to the hard drive in a memorable location. Then identify the different areas of the program that create the links being changed. We don't want to change things on the back-end, just the front-end. The Php file will still be getting the information as, "index.php?category=x," from the .htaccess file. We want to change the display part that users to the site see. This is where links are dynamically created on the Php Script. We need to replace, "index.php?category=," to read, "directory-," where, "index.php?category=X," is found and follow behind the variable (x) with, ".html".

Once the area to be modified is found, check the modification following your changes. If you make a mistake on a script and get ahead of yourself, it may be difficult to fix the problem.

To see this exact modification in action, visit http://links.mjmls.com/index.html. Follow any of the category links on the page. Then change, "directory-," to, "index.php?cat=," and drop the html extension.


About the Author:
Michael Medeiros is the founder of http://www.Mjmls.com an independently owned Internet domain. He has obtained a Bachelors Degree in Business, and works as an Independent Real Estate Agent in New Jersey. With the development of Mjmls.com, Michael has performed extensive research into Website Development. Mjmls.com is a Beta released free marketplace for businesses and individuals, allowing consumers to browse nationally or locally by individual state.

About TheDevWeb
TheDevWeb examines the best tools and techniques to help you keep up with all the latest trends in the fast paced world of web development. Excellence in Development Starts Here

TheDevWeb is brought to you by:

SecurityConfig.comNetworkingFiles.com
NetworkNewz.comWebProASP.com
DatabaseProNews.comSQLProNews.com
ITcertificationNews.comSysAdminNews.com
LinuxProNews.comWirelessProNews.com
CProgrammingTrends.comITmanagementNews.com



-- TheDevWeb is an iEntry, Inc. publication --
iEntry, Inc. 880 Corporate Drive, Lexington, KY 40503
2005 iEntry, Inc. All Rights Reserved Privacy Policy Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

Excellence in Development Starts HereTheDevWebNewsArchivesAbout UsFeedbackTheDevWeb Home PageAboutArticle ArchiveNewsDownloadsWebProWorld ForumsJaydeiEntryAdvertiseContact