0

I have a domain i.e www.domain.org and want to point it to a subfolder on my server. The main domain loads from /public_html and now, I want to load the domain from /public_html/domain2017.

I have researched various solutions on the web, but all I get is a redirect. The redirect is not preferred because I end up with www.domain.org/domain2017 when I want to stay as www.domain.org but load the index.php file of www.domain.org/domain2017. Hopefully, this makes sense. Note: I have a WordPress installation within public_html/domain2017.

Below is example content of my .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.org$ [NC]
RewriteRule !^subdir/ /domain2017%{REQUEST_URI} [L,NC]
</IfModule>

Solution Attempt 1 Solution Attempt 2 Solution Attempt 3 Solution Attempt 4

I have tried all of the above links and they simply redirect my domain to the URL and does not prevent the URL in the address bar from changing

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Markus Proctor
  • 425
  • 1
  • 7
  • 27

1 Answers1

0

You can use the following htaccess:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteCond %{REQUEST_URI} !public_html/domain2017/
RewriteRule (.*) /public_html/domain2017/$1 [L]
DZDomi
  • 1,685
  • 15
  • 13
  • I get the following error Not Found The requested URL /public_html/.....2017/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. – Markus Proctor Nov 30 '16 at 21:24