0

I'm new to using and changing the workings of a server and all that. So far I've only had one server with one domain for myself, but now a business is getting some traction and I want to use a different domain for it while keeping it on my server.

The situation is like this:

I have the main domain and root directory like maindomain.com. I also just bought projectdomain.com.

The files for projectdomain.com are within maindomain.com/project/.

I have established a forward from projectdomain.com to maindomain.com/project/ already, but I can't access sites via the url.

For example:

I wan't to type projectdomain.com/somecontent/ and access maindomain.com/project/somecontent while maintaining the projectdomain.com link in the adress bar.

When I try it now I always end up in maindomain.com/project/ and never in the file I specified in the url.

I've tried working around it with the .htaccess file, but don't really know much about it. What I have now is

RewriteEngine On
RewriteCond %{HTTP_HOST} (www\.)?projectdomain.com
RewriteRule (.*) http://maindomain.com/project/$1 [R=301,L]

Sorry for the noob question, I really don't know much about the topic and I'm not sure what to google to get what I want.

Malte
  • 1
  • Just wondering, if this is your own server, why you are using a subdirectory off the main domain for this project (for which you have a separate domain) rather than using an entirely different area of the filesystem? Are the main site and this project site somehow connected? – MrWhite Apr 20 '19 at 17:29
  • 1
    You should set the document root correctly, not use a rewrite. – Michael Hampton Apr 20 '19 at 17:41
  • I'm puttint it all on public_html folder because my server provider told me to. – Malte Apr 20 '19 at 18:30
  • How would I change the document root correctly? I'm not sure if that is the way to go as maindomain.com should still got to the root's index, I just want projectdomain.com to go to a different folder where the project is – Malte Apr 20 '19 at 18:31

0 Answers0