Search code examples
phpwordpress.htaccessmod-rewrite

htaccess load parked domain name in subfolder


I have a parked domain that I want to load from a sub-folder.

In my root public_html folder I have the following in my .htaccess:

RewriteEngine on
RewriteCond %{HTTP:Host} ^(?:www\.)?parkeddomain\.com(?:|/)$
RewriteCond %{REQUEST_URI} !^/_domains/myparkeddomain_com(?:|/)$
RewriteRule ^(.*)$ /_domains/myparkeddomain_com/$1 [NC,L,NS,QSA]

The problem is when I go to my parkeddomain.com I see my index in /_domains/myparkeddomain_com/ folder but when I try to install Wordpress there it redirects and gets into parkeddomain.com/_domains/myparkeddomain_com/wp-admin/install.php.

How can I configure so it loads without showing /_domains/myparkeddomain_com/ ?

I want /folder and /folder/folder/file.php on my parkeddomain.com to be parkeddomain.com/folder or parkeddomain.com/folder/folder/file.php

  • and not parkeddomain.com/_domains/myparkeddomain_com/folder or parkeddomain.com/_domains/myparkeddomain_com/folder/folder/file.php
  • ...Makes sense?

So essentially what I want is my website on my parkeddomain.com to load from my public_html/_domains/myparkeddomain_com/ as if it were loading from public_html/.

Is it possible to achieve this with .htaccess directive?

Thanks.


Solution

  • It seems that what I was missing was an .htaccess in the the wordpress folder itself.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>