•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,999 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,064 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 5802 | Replies: 5
•
•
Join Date: Aug 2003
Location: Steamboat Springs, CO
Posts: 82
Reputation:
Rep Power: 6
Solved Threads: 0
The following script is a VERY simplified version of a script I've used to make my site more search engine friendly.
To date, according to most reports, Google is one of the only search engine that will index URLs that are in the format: whatever.com/index.php?var1=value&var2=value
Other Search Engine spiders may or will die as soon as a "?" or "&" is reached in the URL.
To get past this issue, so that your site is fully indexed by all search engines, you will need to do three things.
First:
You will need to let your Apache Server know that you want to do this.
Using the ForceType Apache Directive, you can let Apache know that the file "search", or whatever the script name will be (without .php extension), will be treated as a PHP file.
By adding the following to your httpd.conf file, you can make this happen. Just replace the directory path with your directory path to your http documnents folder.
If you don't have access to the httpd.conf file on your web hosting server, you can create a .htaccess file with the same info, and drop it into the root of your web directory. Most web hosts will allow .htaccess files, but some won't.
Second:
You will now need to get your PHP script ready to translate the URLs that we will be sending to it.
I've used the following code on my site, though this is a much more simple version. You will need to use extensive error checking to make sure someone doesn't type in an invalid URL lacking key variables, and print errors if that happens.
[php]
// URL Parsing CODE
list($empty_variable,$php_script,$var1,$var2,$var3) = explode("/",$REQUEST_URI);
// END URL PARSING CODE
[/php]
Third:
You will finally need to make your links point to this new file "search" rather than "search.php" and have the variables appended to the URL. An example link for the previous example would be:
/search/var1/var2/var3/
This will greatly enhance the functionality and ease of use of the site, and the link structure gives the illusion that the pages are actually static pages rather than dynamic to those search engines that don't like ?'s and &'s.
Also, this can make a visitor remembering a specific URL a little easier.
Good Luck! It's well worth the time to get this to work!!! (IMHO)
I've got at least 99% of my pages indexed by google, so it doesn't seem to hurt in any way for sure!!!
To date, according to most reports, Google is one of the only search engine that will index URLs that are in the format: whatever.com/index.php?var1=value&var2=value
Other Search Engine spiders may or will die as soon as a "?" or "&" is reached in the URL.
To get past this issue, so that your site is fully indexed by all search engines, you will need to do three things.
First:
You will need to let your Apache Server know that you want to do this.
Using the ForceType Apache Directive, you can let Apache know that the file "search", or whatever the script name will be (without .php extension), will be treated as a PHP file.
By adding the following to your httpd.conf file, you can make this happen. Just replace the directory path with your directory path to your http documnents folder.
<Directory /home/blah/domain.com/httpdocs/>
<Files search>
ForceType application/x-httpd-php
</Files>
</Directory>Second:
You will now need to get your PHP script ready to translate the URLs that we will be sending to it.
I've used the following code on my site, though this is a much more simple version. You will need to use extensive error checking to make sure someone doesn't type in an invalid URL lacking key variables, and print errors if that happens.
[php]
// URL Parsing CODE
list($empty_variable,$php_script,$var1,$var2,$var3) = explode("/",$REQUEST_URI);
// END URL PARSING CODE
[/php]
Third:
You will finally need to make your links point to this new file "search" rather than "search.php" and have the variables appended to the URL. An example link for the previous example would be:
/search/var1/var2/var3/
This will greatly enhance the functionality and ease of use of the site, and the link structure gives the illusion that the pages are actually static pages rather than dynamic to those search engines that don't like ?'s and &'s.
Also, this can make a visitor remembering a specific URL a little easier.
Good Luck! It's well worth the time to get this to work!!! (IMHO)
I've got at least 99% of my pages indexed by google, so it doesn't seem to hurt in any way for sure!!!
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
adsense adult advertising algorithms blog blogging bomb book business coding competition copyright daniweb development engine environment forum gasoline gentoo google hybrid internal combustion engine legal linux malware marketing mcafee microsoft monetization msn news pagerank php privacy publishing revenue search security seo sex silverlight software spam spyware support technical web webmaster wiki yahoo
- Search Engine friendly vBulletin URL (Search Engine Optimization)
- Search Engine Friendly URL:s in IIS-solutions? (Search Engine Optimization)
- Search Engine Friendly, No reciprocal link free Webmaster Directory! (Relevant Link Exchanges)
- generating txt using php (PHP)
Other Threads in the PHP Forum
- Previous Thread: How to do a more... link
- Next Thread: Need a tutorial on sessions



Threaded Mode