I am having trouble loading fonts and icons hosted on main domain from subdomain.


I am on


and I need to detect that /desired/url/ is in request and based on that redirect to:


So far I failed getting 404 in the subrequest asking for that resource. When I manually enter the desired url in address bar or edit request it succeeds and returns the resource. Given these circumstances I assume the problem is in redirection, so I googled a lot and found solution that is supposed to work, but it doesn't.

I am running Apache 2.4.18 with php7 on Xubuntu 16.04, my vhosts look like this:

<VirtualHost *:80>
    DocumentRoot "/var/www/html/domain/"
    ServerName domain.loc

<VirtualHost *:80>
    DocumentRoot /var/www/html/domain/sub/www/
    ServerName sub.domain.loc
    RewriteEngine on
    RewriteRule ^(.*)desired/url/(.*) domain.loc/url/desired/$2 [R=301,L]

What am I doing wrong?

Also what other stuff should I provide for the others to be able to determine the source of problem?

  • 1
    You should figure out why your subdomain is linking to fonts and icons at wrong URLs. You need to fix it so that the redirect isn't used to load pages. – Stephen Ostermiller Feb 2 '18 at 15:48
  • 1
    Your "redirect" is missing the scheme. However, as @Stephen has pointed out, a redirect does not seem to be the solution to this problem. – DocRoot Feb 2 '18 at 15:56
  • Can you send me your link to investigate.<br> So i can recreate the website experience and the errors you see.<br> Thanks. – jehovahsays Feb 2 '18 at 20:21
  • @Stephen Unfortunately i cannot avoid using the redirect, as i cannot mofify the original URL. <br /> DocRoot What do you mean by missing the scheme? <br /> jehovahsays Unfortunately the links i provided will have to be enough. They represnt structure of the url, they re just anonymized, because i am not allowed to share the actual URLs. – Vulgo Alias Feb 4 '18 at 1:59
  • Docroot means that the scheme is missing because domain.loc/url/desired/$2 should be http://domain.loc/url/desired/$2. – Stephen Ostermiller Feb 4 '18 at 9:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.