[UPHPU] Rewriting Apache URLs
Mac Newbold
mac at macnewbold.com
Mon Aug 7 14:24:37 MDT 2006
Today at 9:34am, Smith, Jeff said:
> I have noticed on a couple of sites the URL is something like
> http://www.somesite.com/index.php/2006/08/07/articleName . I know this
> help with SEO, it also makes for a more meaningful URL compared to my
> current method of index.php?articleID=143. I know this isn't strictly
> PHP related but if anyone will know you guys will. How can I get apache
> to accept this as a URL and PHP to properly interpret it?
Others have already given some great answers, so I'll try to be brief and
different in my comments.
If you're considering it for SEO purposes, you might check a few places on
this site. I subscribe to their mailing list, and it's usually quite
helpful. This topic has come up in her newsletters quite a few times.
http://www.highrankings.com/forum/
I'll cheat and give you the bottom line: sometimes it helps, and sometimes
the change in URLs loses you more than you gain, especially in the short
term. That said, if you've got other motives in mind (usability
especially) then the change in rankings isn't the only consideration, and
it might still be well worth it.
If you're building a new site and are considering it, it's usually easy to
go for it without any big downsides. But Google also is very good at
understanding that http://mysite.com/product.php?id=12 and
http://mysite.com/product.php?id=28 are two very different pages, and it
indexes both of them, so it isn't strictly necessary either. (That didn't
always used to be the case, I think, as some engines used to not traverse
such pages properly.)
Another way you can make Apache accept URLs that do not correlate with
actual files/directories is with the ErrorDocument directive, in which you
specify a PHP script as an error handler script. In that script, you can
see what they were asking for, then decide what to do to respond. If it is
something you expected, you can send back a 200 OK status instead of the
404, and hand them their content as if the file really existed. Otherwise,
you can run a search, show them a 404 error page, or whatever you want.
We've used it in a variety of ways with great success. I did a
presentation on it many months ago for a few people who came, but I don't
think I ever got around to posting the slides.
Thanks,
Mac
--
Mac Newbold MNE - Mac Newbold Enterprises, LLC
mac at macnewbold.com http://www.macnewbold.com/
More information about the UPHPU
mailing list