Forum Moderators: phranque

Message Too Old, No Replies

Parked domain

redirecting example.com to example2.com/example/

         

WhosAWhata

11:38 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



i have example.com 'parked' at example2.com and i want to redirect request from example.com to a folder

example.com/index.php to example2.com/example/index.php

the thing is, I don't want the address bar to show the redirection.

is this possible?

current code:


RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.example\.com¦example\.com)$ [NC]
RewriteRule (.*) http://example2.com/example/$1 [R]

jdMorgan

1:19 am on Sep 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"Parked" is a very ambiguous term, and meaningless for techincal discussions.

Are all these domains pointed to the same server directory space?

If not, you'll have to proxy all requests from example2.com over to example.com which means both servers will have to handle each requests, and the stats on example.com will always show example2.com as the requestor, making the stats reports rather useless.

In most cases the hassle and maintenance costs due to increased complexity aren't worth it.

Jim

WhosAWhata

1:23 am on Sep 23, 2005 (gmt 0)

10+ Year Member



by parked what i mean is I have registered example2.com and have a site there. At a later point i also registered example.com and had my host point it to the same site (if i go to example.com/dir/page it is the same as example2.com/dir/page) really what i'm wanting to do is make it automatically go to a subdirectory

jdMorgan

1:30 am on Sep 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In that case, try searching for the threads here on "rewriterule redirect subdomain subdirectory" using Google or your favorite search engine.

Although you're not using a subdomain, the code is pretty much identical -- all you need to do is to change the domain name in the code where it tests for %{HTTP_HOST} and test for your "parked" domain instead of a subdomain.

Jim

WhosAWhata

1:31 am on Sep 23, 2005 (gmt 0)

10+ Year Member



maybe this solution would be better

if the request is coming from example.com make sure it is already in the example sub directory

example.com/page.php to example.com/example/page.php

example.com/example/anotherpage.php wouldn't be altered because the request is already in the subdirectory

this is my attempted code which returns a 500 error


RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.example\.com¦example\.com)$ [NC]
RewriteCond %{REQUEST_URI} !^example\/
RewriteRule (.*) /example/$1

jdMorgan

1:34 am on Sep 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check your server error log.

Tweaks:


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteCond %{REQUEST_URI} !^/example\/
RewriteRule (.*) /example/$1 [L]

Jim

WhosAWhata

1:39 am on Sep 23, 2005 (gmt 0)

10+ Year Member



works perfectly

thanks