Click to See Complete Forum and Search --> : google index question
brian8765
06-09-2011, 10:28 AM
i have a website that is in essence one page that gets its content depending what is in the query string... Eg. ?page=home. Using apache rewrite rule i have the pages 'site.com/home' rewritte to 'site.com?page=home' which gets its content from text files.... My question is will google index: the text files, the pages with the query string, and the pages with the fake directories... I only wish for the last 1 to be true
donatello
06-09-2011, 01:13 PM
Get rid of the ?
Google hates query strings.
Use QSA (Query String Appends)
Use this for your .htaccess file:
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteRule ^page,search$ index.php?page=search [L]
RewriteRule ^info,(.*)?$ index.php?info=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?$1 [QSA,L]
aj_nsc
06-09-2011, 01:23 PM
You really missed the mark there, Donatello, that wasn't the OP's question.
To the OP, if you only wish for search engines to index the one like site.com/home then you must be sure that that is the only link available to that page on your site.
For instance, if you go out and litter blog posts, forums, and other places on the web with site.com/?page=home, then google will see that link, follow it and index the content. If you instead make sure that anybody linking to you uses site.com/home, then that's the only one google will see.
Google will never index the text files if there are no direct links to them. This will hopefully provide you a clue that google's search engine only has results that have links to them. If I put a site up online and turned it into an island, without any incoming or outgoing links then, from my understanding of it, google would never index it because it would never know about it.
Hope that answer is sufficient.
brian8765
06-09-2011, 03:13 PM
thank you for clearing that up aj... Also for donetello here is the code i will use for my htaccessRewriteRule ^([a-zA-Z0-9]+)/?$ /?page=$1. Is it possible to create a rewrite condition to test if the page exist and to redirect otherwise?
donatello
06-12-2011, 04:41 AM
You really missed the mark there, Donatello, that wasn't the OP's question.
Hehe... Well, I usually frequent these forums before bedtime when my horsepower is winding down... I saw that ? In the query string and snapped at the bait!
Good answer, but still... Kill the question mark that betrays your URL as a generated page based upon a query!
donatello
06-12-2011, 04:48 AM
thank you for clearing that up aj... Also for donetello here is the code i will use for my htaccessRewriteRule ^([a-zA-Z0-9]+)/?$ /?page=$1. Is it possible to create a rewrite condition to test if the page exist and to redirect otherwise?
Yes.
Just make a 404 page that is identical to your homepage and that will properly handle a query string.
I did that here:
http://www.gladstonellc.com
No matter what you enter, you will never ever get a "Page Does Not Exis!"... But instead a copy of the homepage that rather than encourage a searcher to hit the back button, entices them with the homepage content as well as the main menu. Try it by adding any nonsense to the url ...
You can take this a bit further by making your 404 page handle queries usingQSA as I inappropriately answered you (Jumped the gun) in my first post.
Hope this helps!
donatello
06-12-2011, 04:55 AM
One last example of QSA...
Look here...
Http://www.tank-tops.net.
Whatever you add to the end of the url gets generated.
For example...
http://www.tank-tops.net/cat-tshirts
http://www.tank-tops.net/dragon-mousepads
http://www.tank-tops.net/smiley-caps
http://www.tank-tops.net/dog-buttons
Anything that exists in the Zazzle catalog gets generated without a visible query string. You can even type a space in the URL. Try it!
If you do that with your 404 page, users will never go away without seeng some content, and nobody ever gets a 404 - a glorified full page back-button!