You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tapas Mishra <mi...@gmail.com> on 2010/06/14 08:26:02 UTC

[users@httpd] default server serving to change

I have 5 websites running on a webserver.
I read Apache docs Apache serves the vhost file in alphabetical order
of name of vhost file.

I have a few subdomains on main domain

http://mydomain.com

as follows
http://site1.mydomain.com
http://site2.mydomain.com
http://site3.mydomain.com
http://site4.mydomain.com

in one of them which is served by default I want to redirect to
correct http://mydomain.com
so I added in http://site1.mydomain.com

the ReWriteRule in vhost of site1.mydomain.com as follows


 ReWriteRule ^/mydomain.com$ /var/www/index.html [NC,L]
 ReWriteRule ^/mydomain.com/$ /var/www/index.html [NC,L]

I checked the ReWriteLogs by

ReWriteLog "/var/log/apache2/mydomain_rewrite_log"
ReWriteLogLevel 9

could not understand much.

My problem is the ReWriteRule did not do as I wanted it to do.So I
have written some thing in correct.
Can some one help to find what is the problem in above ReWriteRule?

Thanks.
-- 
Tapas
http://mightydreams.blogspot.com
http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] default server serving to change

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
> On Thu, Jun 17, 2010 at 5:15 PM, Matus UHLAR - fantomas
> <uh...@fantomas.sk> wrote:
> 
> >> the ReWriteRule in vhost of site1.mydomain.com as follows
> >
> > why rewrite rule when you can issue redirect by redirect directive?
> >
> > Redirect / http://sice.mydomain.com/

ops, had to be "site".

On 17.06.10 22:21, Tapas Mishra wrote:
> Site1.mydomain.com and mydomain.com are on same Physical machine while
> rest are on different ones.

this completely does not matter

> I could not understand your reply.

It seems that you are trying to redirect access to one or more addresses to
different address. You can do that with "Recirect" directive, you don't need
to play with mod_rewrite. 

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Save the whales. Collect the whole set.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] default server serving to change

Posted by Tapas Mishra <mi...@gmail.com>.
On Thu, Jun 17, 2010 at 5:15 PM, Matus UHLAR - fantomas
<uh...@fantomas.sk> wrote:

>> the ReWriteRule in vhost of site1.mydomain.com as follows
>
> why rewrite rule when you can issue redirect by redirect directive?
>
> Redirect / http://sice.mydomain.com/
>
Site1.mydomain.com and mydomain.com are on same Physical machine while
rest are on different ones.
I could not understand your reply.


-- 
Tapas

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] default server serving to change

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 14.06.10 11:56, Tapas Mishra wrote:
> I have 5 websites running on a webserver.
> I read Apache docs Apache serves the vhost file in alphabetical order
> of name of vhost file.
> 
> I have a few subdomains on main domain
> 
> http://mydomain.com
> 
> as follows
> http://site1.mydomain.com
> http://site2.mydomain.com
> http://site3.mydomain.com
> http://site4.mydomain.com
> 
> in one of them which is served by default I want to redirect to
> correct http://mydomain.com
> so I added in http://site1.mydomain.com
> 
> the ReWriteRule in vhost of site1.mydomain.com as follows

why rewrite rule when you can issue redirect by redirect directive?

Redirect / http://sice.mydomain.com/

(note the trailing slash, it should be there)

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
REALITY.SYS corrupted. Press any key to reboot Universe.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org