Mobile app version of vmapp.org
Login or Join
Fox8124981

: Redirect requests fro fonts and icons to the main domain from a subdomain based on part of the URL path I am having trouble loading fonts and icons hosted on main domain from subdomain. Example:

@Fox8124981

Posted in: #Apache #ModRewrite

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

Example:

I am on

sub.domain.loc/some/weird/path/desired/url/resource/to/load.extension


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

domain.loc/url/desired/resource/to/load.extension


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>

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


What am I doing wrong?

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

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme