如何解决本地 Wordpress 安装正在从 Wordpress 管理仪表板上的 URL 中删除“wp-admin”
我使用 gulp4
通过 browsersync
和 gulp-connect-PHP
代理本地 wordpress 安装。我的 Apache 和数据库正在使用 xampp
运行。该项目位于我桌面上的文件夹中,而不是在 xamp\htdocs\dev
文件夹中
当我运行 gulp
时,wordpress 代理会启动并且可以通过启动浏览器访问:http://localhost:3000/
从那里我可以登录到 wordpress 管理员:http://localhost:3000/wp-admin
然后我被重定向到 wordpress 仪表板:http://localhost:3000/wp-admin
在仪表板中,我从 URL 的左侧菜单条“wp-admin”单击任何链接,因此找不到所需的页面。例如,如果我点击“插件”,我会被定向到 http://localhost:3000/plugins.PHP
而不是 http://localhost:3000/wp-admin/plugins.PHP
端口 8001
是 xampp 将 PHP.exe 设置为的端口。
在数据库中安装时,默认情况下,我的 wordpress siteurl 和 home 都设置为 http://localhost:8001
。
gulpfile.js
//establish vars
var gulp = require("gulp"),sass = require("gulp-sass"),postcss = require("gulp-postcss"),autoprefixer = require("autoprefixer"),cssnano = require("cssnano"),sourcemaps = require("gulp-sourcemaps"),connect = require('gulp-connect-PHP'),browserSync = require("browser-sync").create(),imagemin = require('gulp-imagemin'),concat = require('gulp-concat'),rename = require("gulp-rename"),fs = require("fs"),uglify = require('gulp-uglify-es').default;
//setup the proxy server and browser-sync
connect.server({
base:'./dist',port:8001,keepalive:true
});
browserSync.init({
proxy: "localhost:"+8001,baseDir: "./src",open: true,notify: false
});
// Tell gulp which files to watch to trigger the reload
gulp.watch([
'src/**/*.PHP'
]).on('change',update);
var update = gulp.parallel(
scss,js,moveTheme
);
//compress files,move theme to distribution folder,etc
function scss(){...}
function js(){...}
function moveTheme(){...}
一旦初始化,吞下日志
[browsersync] Proxying: http://localhost:8001
[browsersync] Access URLs:
-------------------------------------
Local: http://localhost:3000
External: http://192.168.1.17:3000
-------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
-------------------------------------
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。