New Style File Path along with internal relative URLs
A link is an absolute link if the whole URL can be used into a browser’s address field to locate a specific page on the Internet. An absolute link specifies a fully-qualified URL:
- the protocol http://
- the site’s domain name
- often a subfolder or specific file name
Relative links, and their paths, can be more complex than simply referencing the file’s name to the web page:
WordPress Style files URLS are usually passed through front template as absolute URL which would look like this:
Using the New Style File Path option, the actual Style filename can be changed from style.css to something else. Depending on the New Theme Path the new URL become somethign like this:
- If New Theme Path is filled in with my_template:
- If New Theme Path is empty:
But style files can also include reference URLs internally to different resources (fonts, images etc), those can be set either as absolute or relative. Booth formatted links will still work fine if theme path and style file path will be changed.
However there’s a scenario when relative links may fail to load within browser: we set the New Style File Path to /folder/new-style-filename.css In such scenario, the front ulr will show as http://www.domain.com/my_template/folder/new-style-filename.css Any relative links located within the style file, will use as base directory the http://www.domain.com/my_template/folder/ even if the files are actually being accessible at http://www.domain.com/my_template/ For that reason some resources may return a 404 error page.
As precaution, in such scenario the New Style File Path should contain only a file name (e.g. new-style-filename.css) and not an actual path structure (e.g. /folder/new-style-filename.css) As theme example, Divi is known for using relative urls within stylesheet file.