0

How to hide the leading site url from the source code example

http://example.com/wp-content/themes/themename/style.css

Becomes

/wp-content/themes/themename/style.css

Removing the main site URL which http://example.com/ from the source code

I've seen many sites running wordpress however they don't have the Site URL shown in the source code for CSS and JS files.

I know there are many plugins that can help hiding wordpress source code so no one will know it's wordpress however none of them removes the Site URL from files links.

  • 2
    Can I ask why you want this? – Jacob Peattie May 17 at 16:49
  • I want this for many reasons, 1. to hide it's wordpress even if I'm using the plugins or hooks that help me do that however the structure of the CMS is still the same and still detectable. Second I want less load of the files to look as static HTML rather a CMS built website. – David Buik May 17 at 20:15
  • Hiding the domain isn't going to hide that it's WordPress. wp-content is right there. – Jacob Peattie May 18 at 1:02
  • True however the first step is hiding the domain and the second step using the plugins to mask urls – David Buik May 18 at 1:25
0

You can write your css codes inside php file, So your css file becomes style.css.php Then you can put it by include_once() in your theme So your css file will not be displayed in your page source code.

| improve this answer | |
  • This is not what I'm looking for exactly, this solution won't support other files. I'm still looking to hide the leading Site URL of the link – David Buik May 17 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.