[svlug] missing web pages

Brian J. Tarricone bjt23 at cornell.edu
Sun Dec 2 15:19:36 PST 2007


On Sun, 2 Dec 2007 15:12:39 -0800 Lisa wrote:

> On Sun, Dec 02, 2007 at 01:58:03PM -0800, Rick Moen wrote:
> 
> > Alvin's point that there should always be redirects from old
> > URLs to their replacements is such a good one that you may
> > recall my _saying_ it to you immediately when you proposed and
> > carried out the PHP conversion.  ;->
> 
> Not sure I recall that... regardless, depending on the size of a
> site, sometimes that's not feasable --- depending on the url and
> how often you change the site.  But, regardless, at the least we
> should be sure that anything substantial is not difficult to
> find.

One thing I've found to be helpful is to never give pages on websites
extensions.  Or, rather, the files on the webserver are of course
foo.php or whatever, but you use rewrite rules to rewrite
http://server.com/foo to foo.php.  Use an internal rewrite so the
end-user never sees the extensions at all.  That way, if you move to a
different scripting language for the files, no links need to change,
and no messy redirects need to be in place for the old files.  You just
need a simple:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$  $1.php  [L]

Of course, if you drastically change the server's directory structure,
this becomes more difficult and less useful.  But the underlying point
is that the .php, .shtml, etc. file endings are an implementation detail
of the website, and there's no reason to expose that to visitors.

	-brian




More information about the svlug mailing list