更改字preSS管理URLpreSS、URL

2023-09-02 09:59:30 作者:趁夜色去见你

我改变了我的字preSS目录结构颇有几分。这是我有:

 定义(WP_SITEURL','HTTP://'。$ _ SERVER ['SERVER_NAME']'/字preSS');
定义(WP_HOME','HTTP://'。$ _ SERVER ['SERVER_NAME']);
定义(WP_CONTENT_DIR,目录名(__ FILE__)'/内容。);
定义(WP_CONTENT_URL,HTTP://$ _ SERVER ['SERVER_NAME']'/内容。);
 

所以我有一个内容目录,其中包含我的插件和主题。然后,我有一个字符preSS 目录,其中包含的核心WP文件,减去的wp-content文件夹。

使用这种新的结构,我需要访问WP后台这个网址: http://site.dev/word$p$pss/wp-admin

有没有一种方法,我可以改变它,我就可以访问它像这样: http://site.dev/wp-admin

我不希望Word preSS是在URL中。这将是我需要一个htaccess更新,或者是有,我可以在我的wp-config.php文件使用一个设置?

解决方案 百度竞价默认Url显示汉字的方法

下面是从字preSS的网站的文章。

  

的http://word$p$pss.org/support/topic/how-to-change-the-admin-url-or-wp-admin-to-secure-login

添加常数的wp-config.php文件

 定义(WP_ADMIN_DIR','秘密文件夹);
定义('ADMIN_COOKIE_PATH',SITECOOKIEPATH WP_ADMIN_DIR。);
 

在下面添加过滤器的functions.php

 的add_filter(SITE_URL','wpadmin_filter,10,3);

功能wpadmin_filter($网址,$路径,$ orig_scheme){
    $旧=阵列(/(可湿性粉剂管理员)/);
    $ admin_dir = WP_ADMIN_DIR;
    $ =新阵列($ admin_dir);
    返回preg_replace($岁,$新,$网址,1);
}
 

添加以下行.htaccess文件

 重写规则^秘密文件夹/(.*)可湿性粉剂管理员/ $ 1〜%{QUERY_STRING} [L]
 

I changed my Wordpress directory structure quite a bit. Here's what I have:

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');
define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']);
define('WP_CONTENT_DIR', dirname(__FILE__) . '/content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');

So I have a content directory which contains my Plugins and Themes. And then I have a wordpress directory which contains the core WP files, minus the wp-content folder.

With this new structure, I have to access the WP backend with this URL: http://site.dev/wordpress/wp-admin

Is there a way I can change it so I can just access it like so: http://site.dev/wp-admin

I don't want wordpress to be in the URL. Would this be an htaccess update I need to make, or is there a setting I can use in my wp-config.php file?

解决方案

Here's an article from wordpress's site.

http://wordpress.org/support/topic/how-to-change-the-admin-url-or-wp-admin-to-secure-login

Add constant to wp-config.php

define('WP_ADMIN_DIR', 'secret-folder');  
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);  

Add below filter to functions.php

add_filter('site_url',  'wpadmin_filter', 10, 3);  

function wpadmin_filter( $url, $path, $orig_scheme ) {  
    $old  = array( "/(wp-admin)/");  
    $admin_dir = WP_ADMIN_DIR;  
    $new  = array($admin_dir);  
    return preg_replace( $old, $new, $url, 1);  
}

Add below line to .htaccess file

RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]