httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jha, Sanjeev" <s...@rational.com>
Subject [users@httpd] Rewrite question
Date Tue, 26 Nov 2002 17:48:58 GMT
I have a rewrite question on which I am trying different options but not
getting exactly what I am looking for-

I am looking for --  Redirect http://domain.com  to http://www.domain.com (
for example).
Note that using DNS, domain.com IS pointing to same IP www.domain.com and
therefore http://domain.com works but for some other reason, we want the URL
to be changed to http://www.domain.com if someone just comes through
http://domain.com. 

I tried following --
	1> RewriteRule ^(domain.com)(/)$ http://www.domain.com/$1 [R]
--> didn't work. Doing nothing.
	2> RewriteRule ^(.*)(/)$   http://www.domain.com$1/  [R]
--> I noticed, it's keep redirecting and site never comes up.
	3> RewriteRule ^(.*)(/)$   http://www.domain.com$1/index.html  [R]
--> This one works. But the problem is I have some part of web site where
there is no index.html but index.jsp or index.htm page only. Therefore
getting 404 for those.
	4> RewriteCond %{HTTP_HOST}   !^domain\.com [NC]
	   RewriteCond %{HTTP_HOST}   !^$
	   RewriteRule ^/(.*)         http://www.domain.com/$1 [L,R]
--> Trying to copy one of the example on apache.org. I might be missing
something. After this change, the site keep redirecting itself to
www.domain.com and like in #2, it never came up.
	5> RewriteRule http://domain.com/(.*) http://www.domain.com/$1 [R]
--> Don't know why I did this, but didn't work either
	6> I tried setting up Virtual host for "ServerName domain.com"  and
"Redirect /	www.domain.com" . Nothing happened.

Any suggestion ?

Thanks,
-Sana

Mime
View raw message