Page is a not externally linkable
- WebmasterWorld
-- New To Web Development
---- How to redesign 450 page site and not lose ranking


jdMorgan - 7:12 pm on Aug 12, 2007 (gmt 0)


Yes, but only because you changed the URL. Please don't confuse URLs with filenames, and please don't change URLs unnecessarily.

URLs are used to locate 'resources' --pages, images, multimedia, etc.-- on the Web. They are meaningless inside a server. Filenames are used to locate files, either data files or executable (e.g. script) files inside a server, and are meaningless on the Web. Simply put, the fundamental job of a server is to accept a URL request and translate that URL to a filesystem path.

This seems to be a difficult concept to convey, but let's take a simple, common example:

Let's say your homepage URL is http://example.com/

There is no such location in your server, though, since no disk drive or filename appears in that URL.

So, when a request for this URL arrives at your server, the server removes the now-unneeded "http://example.com" part, and adds the partial filepath specified by the server's DocumentRoot configuration directive, "C://Program Files/Apache/httpd/dev-sites/my-site" (on a server running on a Windows PC, for example, just to keep on familiar ground here) to the remaining "/".

So far, we now have "C://Program Files/Apache/httpd/dev-sites/my-site/" as the partially-translated filepath.

However, we're still missing any filename, because "/" isn't a filename.

So, the server uses the value defined by the DirectoryIndex configuration directive, and finds that your default index file is called "index.html". So it adds that to complete the filepath.

The completely-resolved filepath is now "C://Program Files/Apache/httpd/dev-sites/my-site/index.html".

So, the URL is
http://example.com/
which resolves to the server filepath
C://Program Files/Apache/httpd/dev-sites/my-site/index.html

The one and only surviving token from the URL that appears in the filepath is a slash...

So again, URLs and filenames are not the same thing, and need not have any fixed relationship with each other.

It's important to grasp this concept because the successful use of mod_rewrite or ISAPI Rewrite depends on it. And far from being a pedantic distinction, it's important to business as well, as you will discover if you change all your URLs and tank your site's rankings...

So, to re-cast your question in orthodox terminology:
If I have a well ranked html page (file):
/Directory/wellranked.html

and I replace that file with:
/Totally_Different_Directory/wellranked.html

How do I tell the server about the new file location, while retaining the same URL?


The answer is to use mod_rewrite to do an internal rewrite:
RewriteRule ^Directory/wellranked\.html$ /Totally_Different_Directory/wellranked.html [L]

I haven't shown the one or two 'overhead' directives required to enable mod_rewrite here, but having already enabled mod_rewrite, that one RewriteRule directive is all that's needed to tell the server where to find the new file associated with the requested URL. And if URLs share common features, they can be rewritten as classes or groups; One rewrite can handle several (or even all) requested URLs. For example, if all HTML files in /Directory are moved to /Totally_Different_Directory, then you could use the single mod_rewrite directive:
RewriteRule ^Directory/([^.]+)\.html$ /Totally_Different_Directory/$1.html [L]

to rewrite all of them.

When executed, the $1 token in the new substitution path (on the right) will take the value of the requested URL-path that matches the first parenthesized subpattern in the RewriteRule regular-expressions pattern (on the left).

In addition, you can define a few exclusions, if needed, by using mod_rewrite's conditional-rewriting directive, RewriteCond.

Jim


Thread source:: http://www.webmasterworld.com/new_web_development/3420112.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com