I currently create my websites using variables to include specific pages, so my URLs look like this: site.com/index.php?section=gallery&category=beach-hotel-pool&id=7
I could just enable mod_rewrite and then my URLs would look like site.com/gallery/beach-hotel-pool/7 which according to Google is more SEO friendly (?) and clean looking.
I met a client who could not enable mod_rewrite, cause of his hosting provider limitations, I suggested they change provider but they didn't want to. Then I suggested we just go with the ? path, and they said it would be bad for their SEO rankings.
I had an idea to create separate pages for each site section like gallery-beach-hotel-pool.php, and inside that include any other files (like header.php, footer.php, functions.php etc), so the final URL would look like site.com/gallery-beach-hotel-pool.php?id=7. This will result to having a lot of different files scattered around like,
gallery-beach-hotel-pool.php
gallery-beach-hotel-rooms.php
gallery-beach-hotel-bar.php
gallery-beach-hotel-services.php etc.
instead of index.php?section=gallery and including the gallery.php in the body by passing variables for the category items.
Which you think works better? How do you work?
Best design for URLs?
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Best design for URLs?
For the last several years this has been considered a best practice both in usability and SEO. Yes.currently create my websites using variables to include specific pages, so my URLs look like this: site.com/index.php?section=gallery&category=beach-hotel-pool&id=7
I could just enable mod_rewrite and then my URLs would look like site.com/gallery/beach-hotel-pool/7 which according to Google is more SEO friendly (?) and clean looking.
If a host didn't provide mod_rewrite I would strongly suggest leaving them in the dust. Explain to your client the importance of keeping with a cutting edge hosting provider, not one stuck in the stone age.I met a client who could not enable mod_rewrite, cause of his hosting provider limitations, I suggested they change provider but they didn't want to. Then I suggested we just go with the ? path, and they said it would be bad for their SEO rankings.
The only alternative you have is, is something like:
Code: Select all
domain.com/index.php/gallery/beach-hotel-poolAll professional developers should use a single index.php as the entry point, going the other route will leave you with way more headaches, that is how I built web sites 10 years ago. Convince your client to switch hosting providers, you are doing them a great disservice by not explaining the situation, IMO.Which you think works better? How do you work?
Cheers,
Alex
Re: Best design for URLs?
I wouldn't even use the term "cutting edge". mod_rewrite is no longer cutting edge - it should be included standard.
Anyway, one thing you might try without needing mod_rewrite, is making your index.php file the 404 error document. I'm not sure on the exact syntax, but you can put something like this in your .htaccess file:
[syntax]ErrorDocument 404 index.php[/syntax]
That'll redirect any pages not found, to your index.php page, which can then properly handle the request. You'll have to do your URL chopping in PHP rather than .htaccess (but it can still be with regex, so really, 6 of one, 1/2 dozen of another). The deal breaker may be that the 404 header may be sent for every page request. That'd be killer to SEO.
Anyway, one thing you might try without needing mod_rewrite, is making your index.php file the 404 error document. I'm not sure on the exact syntax, but you can put something like this in your .htaccess file:
[syntax]ErrorDocument 404 index.php[/syntax]
That'll redirect any pages not found, to your index.php page, which can then properly handle the request. You'll have to do your URL chopping in PHP rather than .htaccess (but it can still be with regex, so really, 6 of one, 1/2 dozen of another). The deal breaker may be that the 404 header may be sent for every page request. That'd be killer to SEO.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Best design for URLs?
LOL true enough. I didn't quite intended to mean a hosting provider that "just" provides mod_rewrite as cutting edge, but I digress. :pI wouldn't even use the term "cutting edge". mod_rewrite is no longer cutting edge - it should be included standard.
Cheers,
Alex
Re: Best design for URLs?
The 404 thing is potential worse for SEO than leaving the URLs ugly. Your client is not being reasonable. You need to explain how their needs cannot contradict each other or fire them. I would not hesitate to dump the client, I've had to do that for extremely valuable clients. When they get to the point they are not only screwing you over on more hours, but doing so for no reason - its time to start looking. Its likely you just didn't explain it right though. I'd call them back up and say "look you asked for SEO URLs, and you asked to use a host that does not support them - those two goals are mutually exclusive", ask them to be reasonable and they should. If not, well....
-
AdamBlackwell
- Forum Newbie
- Posts: 7
- Joined: Tue Sep 28, 2010 4:21 am
Re: Best design for URLs?
The whole purpose of the exercise is to be "more seo friendly", but the benifits associated with the request are very small. URL format carries very little weight if any.
It sound to me like an unfocussed attempt at seo that is going to waste your time. What phrases are each page targeting? Is there a link building campagn in operation? What is the sites internal linking structure? These are MUCH more important (along with about 20 others) and IMO a page deserved of this amount of work should be on a static sub-folder anyway.
Best regards
Adam
It sound to me like an unfocussed attempt at seo that is going to waste your time. What phrases are each page targeting? Is there a link building campagn in operation? What is the sites internal linking structure? These are MUCH more important (along with about 20 others) and IMO a page deserved of this amount of work should be on a static sub-folder anyway.
Best regards
Adam