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:
only the parked domains name shows (ie instead of
Can anyone show me best practice to achieve this on an Apache server?
The code attached is what I have so far..
RewriteRule ^parked-directory - [L]
RewriteCond %{HTTP_HOST} ^(www\.)?myParkedDomain\.com$ [NC]
RewriteRule ^(.*)$myParkedDomainSubdirectory/$1 [L]

Open in new window

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 WorshamStaff Infrastructure 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 ^(.*)$myParkedDomainSubdirectory/$1 [P,L]

Open in new window

Neil_BradleyWeb UX/UI DeveloperAuthor Commented:
Or have it as an add on domain as opposed to a parked domain?
Michael WorshamStaff Infrastructure ArchitectCommented:
I don't understand the question you are asking.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

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 instead of 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.

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

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

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

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

Options +FollowSymlinks
RewriteEngine OnRedirect /parkeddomaindirectory

That should work! :-)

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.
LinuxGuruLinux Server AdministratorCommented:
No problem. You are always welcome :)
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.