0

I have a TYPO3 7.6.x multi-domain setup and need to place different static files on the root level of each domain (WWW.DOMAIN.COM/file1). Is there a way to map a folder somewhere in the tree in a way that everything in it appears at the root level of the domain? I want to use this for favicons and the like. I know there is other ways (e.g. meta tags) to deliver these files but one folder to place them is generally the recommended way and it keeps the html source code clean.

Any advice is appreciated.

Laxas
  • 51
  • 6
  • Maybe I don't understand what you want, but: You can create directories where you want. Simple login to your shell/ftp and create an directory and upload files to it. – René Pflamm Jan 19 '17 at 13:18
  • Yes, but those files will appear under WWW.DOMAIN.COM/some_directory/file but I need them on the root of the domain so that the clients that now the filename will find them. (e.g. https://www.google.com/favicon.ico) – Laxas Jan 19 '17 at 13:21
  • You can also upload files to the root, or create a symlink within your shell. It is not recommended to let your users upload files to there. – René Pflamm Jan 19 '17 at 13:24
  • @RenéPflamm these folders will only be accessible by the admin. In the multi-domain setup there is no single root folder on the server. TYPO3 directs the traffic for each domain. – Laxas Jan 19 '17 at 13:26

1 Answers1

0

You can only symlink one file by file or a folder, it is not possible to symlink each file of an directory into an other directory.

There are commands to symlink all files in an directory to another, but each time you add an file you have to rerun these commands. Look here.

Maybe you can run an cronjob to run these every hour or every five minutes. But I think a simple upload to the root should be much easier.

Edit:

Now I have understand it ^^

You can make rewrites depending on the domain in your .htaccess:

RewriteCond %{HTTP_HOST} ^(www\.)?domain1.tld$
RewriteRule ^favicon.ico$ /typo3conf/my_template/Resources/Public/DomainA/favicon.ico [L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain2.tld$
RewriteRule ^favicon.ico$ /typo3conf/my_template/Resources/Public/DomainB/favicon.ico [L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain3.tld$
RewriteRule ^favicon.ico$ /typo3conf/my_template/Resources/Public/DomainC/favicon.ico [L]
Community
  • 1
  • 1
René Pflamm
  • 3,273
  • 17
  • 29
  • Uploading to a root folder would be fine, however there can't be a single root folder. I got one installation that covers several root pages in TYPO3 and each has a domain. The files on the root lever on each domain need to be different. Normaly the folder where the index.php is could be regarded as the root folder but that doesn't make sense in a multi-domain setup. – Laxas Jan 19 '17 at 13:53
  • Now I have understand the problem... I have edited my answer. – René Pflamm Jan 19 '17 at 13:59
  • Thanks, I'll try this one. I was hoping for a solution that can be configured from the TYPO3 backend but your solution should be more secure. – Laxas Jan 19 '17 at 14:17
  • TYPO3 has no such solution. The favicon can be configured in the typoscript; robots.txt is "global". And the other stuff is user based. – René Pflamm Jan 19 '17 at 14:20