www.webdeveloper.com
Results 1 to 7 of 7

Thread: google index question

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Posts
    58

    Cool google index question

    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
    Last edited by brian8765; 06-09-2011 at 11:30 AM.

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    Get rid of the ?

    Google hates query strings.

    Use QSA (Query String Appends)

    Use this for your .htaccess file:

    Code:
    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]

  3. #3
    Join Date
    Dec 2005
    Posts
    2,984
    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.

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114

    Talking

    Quote Originally Posted by aj_nsc View Post
    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!

  5. #5
    Join Date
    Aug 2010
    Posts
    58
    thank you for clearing that up aj... Also for donetello here is the code i will use for my htaccess
    Code:
    RewriteRule ^([a-zA-Z0-9]+)/?$ /?page=$1
    . Is it possible to create a rewrite condition to test if the page exist and to redirect otherwise?

  6. #6
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114

    Cool

    Quote Originally Posted by brian8765 View Post
    thank you for clearing that up aj... Also for donetello here is the code i will use for my htaccess
    Code:
    RewriteRule ^([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!

  7. #7
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    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!
    Last edited by donatello; 06-12-2011 at 06:01 AM. Reason: Broken URLs, spelling, iPad goofs...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles