PhpRiot
Download Article
Download this article in PDF format with all listings and files.

Price: $5.00 AUD
(Approx. $4.35 USD)

More information
Related Books
Professional Search Engine Optimization with PHP: A Developer's Guide to SEO

Professional Search Engine Optimization with PHP: A Developer's Guide to SEO

Maybe you’re a great programmer or IT professional, but marketing isn’t your thing. Or...

Search Engine Optimization for Flash: Best Practices for Using Flash on the Web

Search Engine Optimization for Flash: Best Practices for Using Flash on the Web

Some people believe that because search engines can't index all of the content in SWF files,...
PhpRiot Newsletter
Your Email Address:

More information

Creating Search Engine Friendly URLs In PHP

Article Comments (5 total)

joycelorenza, 20 November 2008
Comments about Search Engine-Friendly URLs You'll recall that the thing that trips up Google, and maybe even other search engines, when using the PATH_INFO method is the period in the middle of the URL. So what if there was a way to use that method without the period? Guess what? There is! Its achieved using Apache'’s ForceType.The ForceType directive allows you to override any default MIME types you have set up. Usually it may be used to parse an HTML page as PHP or something similar, but in this case we will use it to parse a file with no extension as PHP.So instead of using article.php, as we did in method 1, rename that file to just "article". You will then be able to access it like this: http://www.domain.com/article/999/12/, utilizing Apache's look back feature and PATH_INFO variable as described in method 1. But now, Apache doesn’t know to that "article" needs to be parsed as php. ----------------------------- joycelorenza SEO

Peter, 10 November 2008
One of the major reasons for using a serverside language such as PHP is for the ability to generate dynamic content. Often this will lead to single scripts. Search engine friendly URLs also easily allow you to hide the type of server. =========================== Peter SEO

Maginot, 7 September 2008
Very good article! I was using the 404 error page to handling actions to views based on the controller (MVC style) but without know if that was a good Idea. One thing that Im still missing is that after the 404 page handle the request when it redirects with a header("location") the url changes to the normal way... Very good site, very good articles, congratulations to you all. best regards [ ]s

Moob, 21 August 2008
I have implemented the custom 404 method, but it seems to have a big disadvantage. Although I send a 200 OK header, clients still get a 404 header. Is there any solution for this?

Alex, 14 January 2008

Regarding the last method (custom 404). It's one of the only method you can use on most the free PHP hosts (they more or less never let you use mod_rewrite). But, it has a really big problem, posted data (data in the $_POST array), won't work (works for the $_GET).

Submit a Comment
Use the following form to submit a comment for this article. You can include any required code snippets, which we will format and highlight accordingly.


Note: Before your comment appears on PhpRiot, it must be manually approved. The email address field is optional. If you choose to include it, it will be displayed obfuscated to protect it from spammers.

In This Article


Article History

Jan 10, 2006
Initial article version
Feb 27, 2008
Added the "Using mod_rewrite as a 404 Handler" page to the article