News

Article updates

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
Absolute URLs

WordPress Hide and increase Security for your website


https://wp-hide.com/wordpress-plugin-wp-hide-security-enhancer/

Relative links, and their paths, can be more complex than simply referencing the file’s name to the web page:

Absolute URLs

/category/
/category/another-article/

WordPress Style files URLS are usually passed through front template as absolute URL which would look like this:

http://www.domain.com/wp-content/themes/theme-name/style.css

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:

  1. If New Theme Path is filled in with my_template:
    http://www.domain.com/my_template/new-style-filename.css
  2. If New Theme Path is empty:
    http://www.domain.com/wp-content/themes/theme-name/new-style-filename.css

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.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Scroll to top