Forum Moderators: phranque

Message Too Old, No Replies

PHP Cloaking and Ramifications

         

grandpa

2:12 am on Feb 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm getting to the point now where it's time to look at the impact/ramifications of some of my site implementation. These are most likely issues that the 'big boys' address *before* they get started...

Let me explain. I've started using php pages and MySql on my site. The php seems relatively easy for me (a blessing after struggling thru CSS and apache directives). But obviously, being new to php, there may underlying issues about which I am clueless.

Here's an example. I've replaced several really long drop down lists on one of my pages with a db load of those options. How nice. I can maintain my items and prices in a single place, and any changes are immediately served. I don't have to modify option lists on multiple pages anymore! How nice. So lets call my new php page ITEMS.PHP, and it has an html equivalent document of ITEMS.HTML.

From the server I rewrite all requests for ITEMS.HTML to ITEMS.PHP, with no server response code. Like this:
RewriteRule ^items\.html$ h**p://mydomain/items.php [L]

So when I request ITEMS.HTML, I'm served ITEMS.PHP and my browser tells me I'm looking at ITEMS.HTML. Slick.

But I have 5 questions for this scenario.

1) I assume that spiders as well as users are getting the php page, so any content I want indexed should be in my php document. Valid assumption or newbie misunderstanding?

2) Is there any reason to keep the html version of the page around?

3) This looks like cloaking, smells like cloaking.. it must be cloaking. Am I facing any unknown (to me - my site) problems?

4) When I rewrite these in htaccess, I'm doing it near the top, before I do any other rewrites for the html file. Huh? Yes, I have other rewrites in place for the same html document, because 1) it has been placed in a new sub-domain and 2) it has been renamed. FWIW, I have done that rename with a R=301 flag. I assume that the rewrite to php should occur *before* any other rewrite. Good assumption?

5) I've asked this twice now and never seen a reply. Either I missed a reply, or the question is so obvious it shouldn't be asked. Here goes... What if I can't access my db? Obviously this would cripple my page.. ie., no items available in a drop down list, just for starters. Is there a method to force a fallback to the html page in this sitution?

txbakers

4:57 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't use PhP or htaccess so I can't comment on everything, but on the last point
What if I can't access my db? Obviously this would cripple my page

Yes, it's obvious. If your databse isn't working, you will have not pages.

You might want to make your initial default home page a vanilla HTM page so it will always load.

grandpa

1:03 am on Mar 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm using the php sparingly right now, primarily on a few of my product pages, and on my Exit/Thank You page. Personally I would not consider making the whole site php unless I had a server to run it from. The point being, what are the tech folks at my host doing? I should be able to trust them, but I don't.

grandpa

4:06 am on Mar 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



(bump)

Still wondering about #1, 2 & 3.

shady

4:30 am on Mar 3, 2004 (gmt 0)

10+ Year Member



Hi Grandpa!

1) I assume that spiders as well as users are getting the php page, so any content I want indexed should be in my php document. Valid assumption or newbie misunderstanding?

The RewriteRule is executed on the server to control what is sent down the line. There is no reason why the bots should see anything different to the user.

2) Is there any reason to keep the html version of the page around?

Perhaps as a backup! Even if you were to have a problem with mysql (why should you, mind you), these would not be accessed, as the RewriteRule will override the backup of the original .html files, however you would be in a position to remove the .htaccess and revert to your original site.

3) This looks like cloaking, smells like cloaking.. it must be cloaking. Am I facing any unknown (to me - my site) problems?

I can see no reason why. Cloaking is usually used to serve up one set of pages to a search engine, which are nasty spammy pages specifically designed for ranking purposes, then a second pleasing to the eye (or perhaps even a non related) set of pages to the surfer.

Regards
Shady

grandpa

9:33 am on Mar 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks shady

That clarifies a few things. I'm still feeling more like a lemming than a webmaster when it comes to using php. Every day I walk away from here waiting to be "ambushed".

Can anyone recommend good reading for php that addresses the issues of implementation?

slade7

4:22 am on Mar 11, 2004 (gmt 0)

10+ Year Member



Grandpa - The rewrite thing is not cloaking that will get you in any kind of trouble with the search engines. Even if the page has a php extension, the source code for it will be pure html, and that is what the bots see.

If it makes you feel any better, I run a pretty large site (30,000+ pages), and my home page is 50% or better dynamic - php/mysql, pulls visible content from two different databases. If PHP or mysql quit working I'd be teats up for a while - but it's been fine for several years. I do have a good hosting service. I have a few pages that would be crispy-fried if the php/mysql didn't work

I try to put my pages together so that if there's a db problem, the user will get at least the framework of the page, the menu, and basic options - even if all the rest of it doesn't work. If you have a decent host, you can bet that if something goes down, they'll be sweating blood till they get it fixed. I have had the occasional outage (server, not php or mysql), but not for more than a few minutes at a time. They switch to a backup pretty quick.