Doing away with the Plone site ID in the URL

February 2nd, 2005

OK, so I'm part of the way there.

I had a static home page URL of http://www.itauthor.com/index.html

I have a Plone site whose site ID is "plone".
You can access my Plone site using the URL http://www.itauthor.com/plone and once in there, anything within the Plone site has the URL http://www.itauthor.com/plone/something

I have a MovableType blog with the URL http://www.itauthor.com/notes

What I wanted was to replace the static home page with the Plone site - doing away with the "/plone" bit in the URL, but still be able to access my MovableType blog with the same URLs as before.

I have achieved this much by adding the following bits in bold to my Apache httpd.conf file:

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/notes.*
    RewriteCond /var/www/%{REQUEST_FILENAME} !-f
    RewriteRule ^(.*) http://localhost:8080/VirtualHostBase/http/www.itauthor.com:80/VirtualHostRoot/plone$1 [L,P]

The existing rewrite rule says take everything in the URL after the domain name and, provided the preceding rewrite conditions are met, put this at the end of a new URL (pointing to the Zope server on port 8080) and redirect the request to that URL.

The two conditions say that for this to happen:

a) the requested URL cannot have "/notes" immediately after the domain. This ensures that http://www.itauthor.com/notes is not rewritten and instead causes the current index page of my MovableType blog to be displayed.

b) the requested page cannot be a file within /var/www. This allows CGI requests to avoid URL rewriting. So, for example, a request for http://www.itauthor.com/cgi-bin/lets/pretend.cgi does not get rewritten and forwarded to the Zope server if the file /var/www/cgi-bin/lets/pretend.cgi exists.

All fine and dandy, except this doesn't really do what I want, because although you can now enter http://www.itauthor.com in a browser address bar and get the page you previously only got by entering http://www.itauthor.com/plone, once you are in the Plone site, all the links use the superfluous "/plone" in their path. This Zope object is required because it allows me to create as many different Plone sites as I want to.

But in my case I just have one site, so I want links to my stuff about authoring tools to use the URL http://www.itauthor.com/authtools rather than http://www.itauthor.com/plone/authtools.

Andy McKay's book provides no clue, that I can find, as to how to do this, and I have spent many unfruitful hours scouring pages of semi-related internet pages without success - so far.

I'm sure it's possible because I've looked at other Plone sites that use nice small URLs in links. I just can't for the life of me find the answer.

Needless to say, I'll post the details here when I do.

Leave a comment