Forum Moderators: phranque

Message Too Old, No Replies

Trying virtual host in .htaccess

.htaccess virtualhost redirect domain another-domain subfolder

         

nacho84

5:04 pm on May 10, 2004 (gmt 0)

10+ Year Member



I've a problem
I'm using this to redirect a URL parked in the same host, but its necessary to enter de url like this:

[another-domain.com...]

instead of

[another-domain.com...]

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.another-domain\.com [OR]
RewriteCond %{HTTP_HOST} ^another-domain\.com
RewriteRule ^/(.*) /another-domain/$1

It'd be goul to say that the content it's under
[domain.com...]
for example

anyone could help...

thanks!
Nacho
Argentina

PD: No virtualhosting! I cannot touch the httpd.conf :)

jdMorgan

2:40 am on May 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nacho,

Welcome to WebmasterWorld [webmasterworld.com]!

The problem is in your Rule - the leading slash on the pattern is not required in .htaccess.


RewriteRule [b]^([/b].*) /another-domain/$1

Jim

nacho84

3:06 am on May 11, 2004 (gmt 0)

10+ Year Member



thanks, but it gives a 500 error.
I've already tried...

jdMorgan

3:30 am on May 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, then there is something causing this not to work as expected, either in your .htaccess file, or in the httpd.conf server config file.

Do you have a RewriteBase directive in your .htaccess file?

Also, your notation, "/another-domain/$1" is confusing. This should be a canonical URL if it is indeed a different domain, and you should choose a 301 or 302 redirect:


RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

This is an extremely simple rewrite, so something else is causing problems.

Jim

nacho84

4:32 am on May 13, 2004 (gmt 0)

10+ Year Member



Thanks but gives error again.
Not with the [R,L] but I was trying to do it "silently", in other words without changingde URl bar of the navigator.

So the ^(.*)$ gives error if I don't use [R,L]. if anyone could help...

I'm new in the forum, seeing little I can say a good work is done here.

Sorry my english, plz.

Nacho