[Novalug] How does htaccess work?

Peter S. May psmay@halfgeek.org
Mon Nov 13 22:12:23 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joseph LeBlanc wrote:
> If I'm understanding what you're trying to do, I would think that this
> .htaccess rule would work:
> 
> RedirectMatch (.*) http://www.domain.com/directory$1
> 
> This is similar to what I'm using to redirect an old subdomain to a new
> domain.

This would probably work.

> You might have to add a check to make sure the request does not already
> include '/directory' though.

I went to the trouble/misery of figuring out mod_rewrite a while back,
so I would pull it off something like this:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/directory
RewriteRule ^/(.*)$ /directory/$1 [R,L]

Granted, a hit on http://www.example.com/directory/something would
probably hit the .htaccess in /directory instead of in the root.  YMMV.

Word
PSM
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWTQUei6R+3iF2vwRAg4EAKC6NNEc57PeIKjQwx1zUhXx7VR3DACgsTen
Y+2DArM1lhpvR6ihDR33h48=
=ziLN
-----END PGP SIGNATURE-----



More information about the Novalug mailing list