redirect parked domain to same domain but different php-file

Using a single web hosting account to host multiple sites

redirect parked domain to same domain but different php-file

Postby 11010010 » Fri Oct 27, 2006 4:44 am

hello. i have been searching this forum now for 2 hours but couldn't find a solution for my problem. everything seems similar but adapting solutions didn't solve it..

my case: i have 2 domains (i.e. domain1.com and domain2.com), one is the normal hosting-package domain (domain1.com), the other one is a parked domain. they both use the same root-directory, but different php-files.. (for domain1.com is is called d1, for domain2.com d2) .. no php-extension due to the SEO-domain-style (menuepoints have links like this: www.domain2.com/d2/article/summer)

i have so far a php solution, but this is not very search-engine-friendly.

well, my mod_rewrite script so far:

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/d2(/.*)?$
RewriteRule ^(.*)$ /d2$1 [R=301,L]


one of the 10 million scripts i tried and it doesn't work. i tried to write something that also recognizes if there is already a d2 behind the URL and also checks if the URL is written with www or without.. it MUST take always the d2 if the URL is domain2.com, same for domain1 ..

can anybody help?

to make this work in domain1 also, will it be ok to duplicate the code without the RewriteEngine on while changing the variables (domain2.com > domain1.com, d2 > d1)?

thanks for your help... :(
11010010
 
Posts: 1
Joined: Fri Oct 27, 2006 4:05 am

Postby richardk » Fri Oct 27, 2006 5:54 am

Try:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com$ [NC]
RewriteRule !^d1(/.*)?$ /d1%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$ [NC]
RewriteRule !^d2(/.*)?$ /d2%{REQUEST_URI} [R=301,L]


If that doesn't work:
What are you typing in the address bar of your browser?
What happens?
What were you expecting to happen?
Are you sure you are able to use mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: Majestic-12 [Bot] and 18 guests

cron