Jump to content

subdomain show content of folder inside root


froot
 Share

Recommended Posts

I'm trying to install Matomo on my host (world4you). For that purpose, I created a subdomain, a database and a folder in the root. In the subdomain settings I let it point to the created folder. However, the contents of the folder cannot be accessed in browser because it's redirecting to www So I have analytics.mydomain.tld and it's redirected to www.analytics.mydomain.tld

I guess that's a .htaccess issue in the first place. But how do I amend the .htaccess-file of the site-root without affecting the main site?

Here's I guess the relevant part of the .htaccess file
 

  # -----------------------------------------------------------------------------------------------
  # 13. Optional domain redirects (O)
  
  # Redirect domain.com to www.domain.com redirect (or www to domain.com redirect). 
  # If using then uncomment either 13A or 13B, do NOT uncomment both of them or nothing will work.
  # -----------------------------------------------------------------------------------------------

  # 13A. Redirect domain.com and *.domain.com to www.domain.com (do not combine with 13B): 
  # -----------------------------------------------------------------------------------------------
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteCond %{SERVER_ADDR} !=127.0.0.1
  # RewriteCond %{SERVER_ADDR} !=::1
  # RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
  
  # 13B. Redirect www.domain.com to domain.com (do not combine with 13A):
  # -----------------------------------------------------------------------------------------------
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]

 

Link to comment
Share on other sites

Just to get this right... does your folder structure within your hosting look like this?

image.png.4f41a43df10c8b128ed9dd737b3917f5.png

If so... that's NOT how you do it.

Each domain and (almost) all subdomains should have their very own folder. A bit more like this:

image.png.d2a39befedc7a76b83492a394adcc5cf.png

There should be a tool or config where you can map domains and sub-domains to their very own folder.

Otherwise you will almost always have issues.

Your ProcessWire on www.mydomain.tld isn't able to change behaviour of matomo.mydomain.tld UNLESS you mix it up like in the first screenshot.

  • Like 2
Link to comment
Share on other sites

OK that makes sense and you guessed right, my setup looks like screenshot #1

I can of course change it to be like #2 and point the/map subdomain to their folder accordingly.

What do I have to consider? I guess I have to change a path somewhere in the setup? config.php? .htaccess? javascript files? database settings?

The site is live, you know…

Link to comment
Share on other sites

12 hours ago, fruid said:

What do I have to consider? I guess I have to change a path somewhere in the setup? config.php? .htaccess? javascript files? database settings?

In terms of ProcessWire:
Probably absolute nothing - maybe clearing cache and cookies.

In terms of Matomo:
I'm not that sure if there is a path somewhere or anything that needs to be fixed.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...