arked domain redirect

I am attempting to use an htaccess file to
1. re direct a parked domain to a subdirectory
2. Mask the url so that instead of showing this: www.primaryDomain.com/myParkedDomainSubdirectory/
only the parked domains name shows (ie www.myParkedDomain.com instead of www.primaryDomain.com/myParkedDomainSubdirectory/)
Can anyone show me best practice to achieve this on an Apache server?
The code attached is what I have so far..
Cheers,
N
RewriteRule ^parked-directory - [L]
RewriteCond %{HTTP_HOST} ^(www\.)?myParkedDomain\.com$ [NC]
RewriteRule ^(.*)$myParkedDomainSubdirectory/$1 [L]

Open in new window

LVL 5
Neil_BradleyWeb UX/UI DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael WorshamInfrastructure / Solutions ArchitectCommented:
mod_rewrite won't be able to 'mask' the domain name. You will have to use mod_proxy capabilities for that.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?myParkedDomain\.com$ [NC]
RewriteRule ^(.*) http://mysite.com/domains/$myParkedDomainSubdirectory/$1 [P,L]

Open in new window

0
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
Or have it as an add on domain as opposed to a parked domain?
N
0
Michael WorshamInfrastructure / Solutions ArchitectCommented:
I don't understand the question you are asking.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

LinuxGuruLinux Server AdministratorCommented:
First of all i think you are misunderstanding park domain. If you are pointing the website to a sub directory its actually an addon domain. Park domain means we just add an alias in the httpd.conf.

According to you, you need to show www.myParkedDomain.com instead of www.primaryDomain.com/myParkedDomainSubdirectory. Just place the following code and you should be able to accomplish this.

Here is what you need to put in you .htaccess file in the directory that houses your "myParkedDomainSubdirectory".  ie. www.primaryDomain.com/myParkedDomainSubdirectory/

Options +FollowSymlinks
RewriteEngine OnRewriteCond %{HTTP_HOST} ^parkedomain\.com [NC]
RewriteRule ^(.*) http://www.parkeddomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.parkeddomain.primarydomain\.com
RewriteRule ^(.*)$ http://www.parkedomain.com/$1 [R=permanent,L]

RewriteCond %{HTTP_HOST} ^parkeddomain.primarydomain\.com
RewriteRule ^(.*)$ http://www.parkeddomain.com/$1 [R=permanent,L]

And add this to the .htaccess file in the root domain: ie. www.primarydomain.com

Options +FollowSymlinks
RewriteEngine OnRedirect /parkeddomaindirectory http://www.parkeddomain.com

That should work! :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
Great answer and many thanks for your help.
Cheers,
Neil
0
LinuxGuruLinux Server AdministratorCommented:
No problem. You are always welcome :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.