It would be a nice addition if there was a way for a webpage to specify where its source repository was, for example by including a html link element in a webpage -
<link rel="fossil-repository"
This way, one could easily get to the source repository even if the site url is not being served by fossil directly.

It wouldn't make sense for this to be built into "clone"; a separate "autoclone" command that fetched the given url and looked for the link reference and then called "clone".   This functionality can be achieved with an external 2-line shell script, but that goes against fossil's all-in-one philosophy.

I do not understand what is being requested here.  Please elaborate.

It would not be a stretch to say that this feature request is poorly thought-out, needless bloat, or unnecessary.

The inspiration comes from setting up a self-hosted project on sourceforge.  The project homepage is which can be redirected (with php) to some other page.  As it stands, I don't think fossil will follow a 301/302 http redirect, so it would do no good to instruct people to "fossil clone They need to find the explicit url of the repository and use "fossil clone But wouldn't it be nice if they could just use the home page?

Just following redirects is helpful but not enough - what if the home page is still some plain html page?  So instead, if the home page had some indicator on it to allow a program to discover where the source is (similar to rss autodiscovery) then an interested user/developer could clone the repository right from the home page, without needing to track down the link to the actual repository.  (I don't know if any other systems have a similar convention, but if such a thing became widespread the search engines could make use of it)

The effect would be roughly the same as the shell command:

$ fossil clone `curl | grep '<link rel="fossil-source" '| sed

IMO, it is not a problem of fossil. Use RewriteEngine or whatever else. It would be enough. My Apache .htaccess is like:
<verbatim>
# You don't need this part:
<FilesMatch "\.repo$">
  Options +ExecCGI
  AddHandler cgi-script .repo
  RewriteEngine Off
</FilesMatch>

# But you need this (you might want to replace foo.repo with
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT}
RewriteRule ^(.*) [L]
</verbatim>

Closing as part of spring cleaning.