Forum Moderators: phranque
So my question is, do I get a key for the root directory only, or do I need to get a key for the rewrite 'directories' that aren't really directories? If, for example, I wanted to post a map at [domain.com...] would I need a key for this or does it understand that there really isn't such a directory?
I apologize if this is a stupid question. It doesn't make sense to me that the API would not understand this, but it seems to be a question worth asking.
Thanks.
I'm currently making a site that uses mod rewrite to redirect urls. So, http://example.com/1/2/3 would redirect to http://example.com/index.php?category=1&page=2&subpage=3.
If you are using a redirect, rather than an internal rewrite --and mod_rewrite can do either-- then the index.php script URL gets 'exposed' to the client, which in the case of a search engine spider, will result in the index.php script URL getting listed as a the 'real' URL.
Use an internal rewrite instead, and clients will be completely unaware that you're using a script to generate the pages, and example.com/1/2/3 becomes the 'real' URL.
Tutorial: [webmasterworld.com...]
Jim
[edited by: jdMorgan at 11:52 pm (utc) on June 4, 2007]
The most explicit way to put it is that an external redirect is a server response sent to the client. This response ends the client's initial HTTP request. If the client cooperates and issues a second HTTP request using the new URL given in the server's initial redirect response, then a URL-to-URL translation is effected.
An internal rewrite is simply a non-default URL-to-filename translation, and occurs entirely inside the server and within the context of the client's initial HTTP request.
Jim
RewriteRule /*index\.php - [L]
RewriteRule ^index/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?category=$1&page=$2&subpage=$3 [L]
RewriteRule ^index/([^/]+)/([^/]+)/?$ /index.php?category=$1&page=$2&subpage=default_page [L]
My Maps API key is registered for the root of the domain, and thus far it's being used two "directories" down from the root, in www.example.com/category/page/. No issues have arisen from this.
Thanks for your input.
URLs and filepaths can be and most often are completely-different things. Does Google know the name of the disk that your files are located on? No. Does it know your "account name" on the server -- like "/users/your-site/htdocs"? No. That's because the server consistently hides this part of the filepath. But beyond that level, it is up to you to implement your rewrites, redirects, and scripts so that your server filepaths remain hidden. This is why I previously emphasized the important distinction between an internal rewrite and an external redirect.
Look for a redirect response (301 or 302) from your rules or from your script(s) that is 'exposing' the real directory path to Google.
Jim
Look for a redirect response (301 or 302) from your rules or from your script(s) that is 'exposing' the real directory path to Google.
i often us lwp-request for this purpose:
lwp-request -Sd http://www.example.com
the -S option displays the status chain and the -d option excludes the document output from the printed response.
typical results might look like:
GET http://www.example.com/1/2/3 --> 301 Moved Permanently
GET http://example.com/1/2/3 --> 302 Found
GET http://example.com/index.php?category=1&page=2&subpage=3 --> 200 OK