Hide wp-content from URL

2019-09-20 16:35发布

问题:

So 2 days ago I launched our city website here and tried checking for some vulnerabilities using an online wordpress vulnerabillity scanner based on WPScan and I got this result:

As you can see, the first one shows my installation directory and the name of my theme. The url given by the first one is http://tuguegaraocity.gov.ph/wp-content/themes/citygov/ which shoes the name of my theme also. Is there a way that I can hide this? Or any other good way to make it safer. Thank you!

回答1:

This should work, Add this in your wp-config.php

PHP

define( 'WP_CONTENT_DIR', 'YOUR_LOCAL_PATH' );
define( 'WP_CONTENT_URL', 'YOUR_PUBLIC_PATH' );


回答2:

You can change the name of the theme to your own theme name or whatever name you like as per your wish.

Methods to follow to change up the theme Name

  1. Open up your theme style.css and you will find the Theme name along with theme information over to the top of the file.
  2. Rename the Theme name and theme Description to your required details and then save the file.

Ensure that while doing this your theme is under De-active mode.

Ex:

Before changing the theme name your URL looks like :

http://tuguegaraocity.gov.ph/wp-content/themes/citygov/

After changing it will be like

http://tuguegaraocity.gov.ph/wp-content/themes/yourname/

/*
Theme Name: Twenty Thirteen
Theme URI: http://wordpress.org/themes/twentythirteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: twentythirteen

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/

Like the above you will be finding the theme info in style.css and you can make the change over there.