carlg Posted January 2, 2008 Share Posted January 2, 2008 I'm just wondering how some of you handle SEO with your php pages. Let me give an exmaple of a scenario. Let's say I have a site that sells cars. Users of the site create an account and list their cars for sale (So my site sells cars that are owned by many different people). When the seller enters the details for a new car it goes into a mysql table. Now lets say a buyer searchs for Honda, it goes to the database, pulls out the Hondas and dynamically creates the pages (using php). Problem is google is not finding the indiviually created page that looks something like this showcar.php?carid=234 My solution to this problem is run a cron job that looks for changes to the "cars" database table. Everytime a user edits a car or enters a new one, I could call php from the command line passing in the id variable from the db table and generating a static HTML file. Now I will have 1 html file for every car that is in my datbase which makes it more SEO friendly. I figure in about 2-4 hours, I could throw together some shell scripts to do this. What do you think? How do you overcome this problem? Thanks for any input Carl Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/ Share on other sites More sharing options...
aschk Posted January 2, 2008 Share Posted January 2, 2008 Well, how do normal people get to the honda in question? And more importantly can google get to it the same way? If you generate an URL that google can traverse, i.e. <a href="showcar.php?id=234">Honda Car</a> then I doubt it will have a problem indexing your honda car. Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/#findComment-428306 Share on other sites More sharing options...
carlg Posted January 2, 2008 Author Share Posted January 2, 2008 They would bring up a page called honda.php which would show summaries of all of the honda allowing them to click a link for further detail. honda.php is not static since the number of hondas can be different on any given day. I was reading somewhere that I can use mod_rewrite to solve this problem, but I'm still not sure if it's the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/#findComment-428318 Share on other sites More sharing options...
tibberous Posted January 2, 2008 Share Posted January 2, 2008 Yeah, thats the way you want to go. Check out my site: http://www.flashgamereviews.com/ All the pages show up as html pages in the main directory, in actuality they are all calls to index.php, which then uses the request uri to output the correct page. It also uses mod_rewrite to protect the directories that hold the sites code. The basic rule looks like this: RewriteRule ^([A-Za-z0-9-!])+\.html$ index.php RewriteRule ^([A-Za-z0-9-!])+/([A-Za-z0-9-])+\.html$ index.php Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/#findComment-428328 Share on other sites More sharing options...
aschk Posted January 2, 2008 Share Posted January 2, 2008 I imagine google is already indexing your cars. Assuming it follows the links you provide it. Have you googled "site: yoursite.com" and seen what results you get? The URL itself doesn't look particularly nice but as far as google is concerned it's more interested in what content is behind each url. The only issue here is that you are using a query string e.g. ?id=<num> Sometimes google likes these, sometimes it doesn't. Bit of a grey area, but it should work fine. I think what you're after is something like www.yourdomain.com/honda/234.html It looks marginally more SEO friendly and can be achieved using mod_rewrite (as you suggested). A rule something like : RewriteRule ^honda/([0-9]+)\.html$ showcar.php?id=$1 It should allow you to produce links in the format i showed above in your html and still get the same results. p.s. the rewrite rule was off the top of my head. Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/#findComment-428330 Share on other sites More sharing options...
carlg Posted January 2, 2008 Author Share Posted January 2, 2008 Thanks guys I may look more into the mod_rewrite I thought the scripts would be kinda neat, but I will research further. carl Quote Link to comment https://forums.phpfreaks.com/topic/84141-solved-php-and-seo/#findComment-428346 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.