[BlueOnyx:07959] Apache Rewrite Conditions

MuntadaNet Webmaster webmaster at muntada.com
Tue Aug 2 15:18:09 -05 2011


I have a site that has the following written in its site configuration:

RewriteEngine on
RewriteCond %{HTTP_HOST}                !^208.80.9.51(:80)?$
RewriteCond %{HTTP_HOST}                !^www.cecicleary.com(:80)?$ [NC]
RewriteCond %{HTTP_HOST}                !^cecicleary.com(:80)?$ [NC]
RewriteCond %{HTTP_HOST}                !^www.cecisportmodeling.com(:80)?$ [NC]
RewriteCond %{HTTP_HOST}                !^cecisportmodeling.com(:80)?$ [NC]
RewriteCond 
%{HTTP_HOST}                !^www.ceciclearyproductions.com(:80)?$ [NC]
RewriteCond %{HTTP_HOST}                !^ceciclearyproductions.com(:80)?$ [NC]

RewriteRule ^/(.*)                      http://www.cecicleary.com/$1 [L,R=301]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))?           /home/.sites/85/site23/users/$1/web/$3

What I would like to accomplish is if www.cecisportmodeling.com is 
given in the browser, rather than simply rewriting it and returning 
www.cecicleary.com that it will actually provide what is at 
http://www.cecicleary.com/modeling/.  As an added bonus, it would be 
great if it is rewritten so that it says www.cecisportmodeling.com 
without any /modeling hanging.

I realize that I will need to put this into the siteXX.include 
file.  I also believe I have answered my previous question about the 
web alias redirects.  When checked, it keeps the server aliases in 
the configuration but it takes away the rewrite conditions which I am 
guessing is what I will need if I am to provide some custom rewrite conditions.

I just need a small help here because I think I have an idea but I am 
still just not quite there.  For example would this be what I need in 
my sitexx.include file.  It doesn't seem to work but I am wondering 
if I am on the right track:

RewriteCond %{HTTP_HOST}                !^www.cecisportmodeling.com(:80)?$ [NC]
RewriteCond %{HTTP_HOST}                !^cecisportmodeling.com(:80)?$ [NC]

RewriteRule 
^/(.*)                      http://www.cecisportmodeling.com/$1 [L,R=301]
RewriteOptions inherit
AliasMatch 
^/~([^/]+)(/(.*))?           /home/.sites/85/site23/users/$1/web/modeling/$3




More information about the Blueonyx mailing list