[Techtalk] Mod Rewrite rules

Chris Wilson chris+linuxchix at aptivate.org
Mon Sep 21 13:26:07 UTC 2009


Hi all,

On Mon, 21 Sep 2009, Wim De Smet wrote:

> On Sun, Sep 13, 2009 at 8:33 AM, Michelle Murrain <michelle at murrain.net> wrote:
> > One thing remains. The main page of the blog is at domain1.com/blog. I
> > would like to redirect "domain2.com/" (and only that - no other pages
> > below it) to point to /blog
> >
> > This is what I've got so far in my .htaccess file:
> >
> >   RewriteCond %{HTTP_HOST} ^domain2.com$
> >   RewriteCond %{REQUEST_URI} =/
> >   RewriteRule ^/$ /blog/
> >
> > Alas, this doesn't work.
> 
> Did you ever get this to work? It just occurred to me that you might 
> want to rewrite /index.html? as well. Seeing as the browser might 
> default to those (though I'm not entirely sure which he triest first, I 
> think he only tries them if he gets a 404 on /).

It doesn't sound like a job for mod_rewrite at all. I'd say this would do 
it much more easily:

<virtualhost *>
	servername domain2.com
	redirect / http://domain1.com/blog/
</virtualhost>

Cheers, Chris.
-- 
Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.


More information about the Techtalk mailing list