SE-Friendly URL's with PHP... not mod_rewrite??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

SE-Friendly URL's with PHP... not mod_rewrite??

Post by seodevhead »

Hey guys... I have some scripts that I am interested in doing some SE-friendly URL'ing to (ie. mod_rewrite). After searching for some tutorials on how to do mod_rewrite... I came across this tutorial on how to achieve the same thing but instead of using mod_rewrite engine... it uses PHP instead:

http://www.tutorio.com/tutorial/php-alt ... endly-urls

At the end of the tutorial, they gave some comparison opinions between Mod_Rewrite and the PHP method:

Comparison with mod_rewrite

Flexibility:
Mod_rewrite is much more flexible than the php method, but whats fexible to some is complicated to others

SEO:
I think that both are pretty much equal. The only problem with the php method is the urls sometimes become very long. Still this is more of a user friendliesness problem than a SEO problem

Sever Resources:
This is where the php method really shines, specially for larger sites. Because doing mod_rewrite on sites with a lot of pages takes up a large amount of resources. This is also the reason why tutorio.com uses the php method for our urls.

Is this true? Have any of you guys used this method? I have quite a bit of DB apps that are going to have quite a many (thousands) of pages (much like these forums) and am considering server resources (eventhough I have a dedicated luckily). So any advice on this matter is greatly appreciated. Thanks for your replies.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I don't see any problems with mod rewrites. Here's how I do it.

Sample Rewrite Rule

Code: Select all

RewriteEngine On

RewriteRule ^/user/blog/([0-9]+)_.+.html$ /blog.php?blogid=$1
In this example, it will capture the ID of any blog, along with any title, and redirect to the blog. Some sample URLs would look like this.

/user/blog/42_my-blog-about-something.html
/user/blog/33883_my-other-blog-about-something-else.html
/user/blog/233_some-other-blog

Now, this only uses one mod rewrite rule, but is unlimited in the number of blogs it could be redirected to. I don't see any heavy resource usage in that. I actually use this on some heavily accessed applications, and having no resource problems.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply