viande
viande

Reputation: 97

Wordpress with Gulp & Browser-sync is not loading index page anymore (can't redirect)

I was developing a Wordpress theme using Gulp & Browsersync normally. But now I can't access to the homepage : It says something like 'can't redirect'. Still, I can access to the back-end (wp-admin).

Everything was OK until I had to change the Site title (through back-end > Settings > General).

  1. The Home URL was set to //localhost:3000/mysite, I don't know how it was set that way.
  2. I couldn't save my page as this Home URL was not conform to Wordpress, so I changed it to http://localhost:3000/mysite.
  3. Then I could access to Wordpress homepage, but I was able to access Wordpress back-end (wp-admin).
  4. So I changed the siteurl & home to //localhost:3000/mysite again directly in the database. Then, I couldn't do anything (go to either front-end or back-end).
  5. I put back http://localhost:3000/mysite in the database and clicked twice to save Permalinks : But this didn't changed anything.

When I change the Home + Site URL to http://localhost:8888/mysite, everything is working well. I guess it's coming from BrowserSync who was able to set the port to 3000.

Here is my gulpfile about BrowserSync, I'm proxying the 8888 port as I'm using MAMP :

/****** BrowserSync ******/

const server = browserSync.create();
export const serve = done => {
  server.init({
    proxy: "localhost:8888/humblyhealthy", // put your local website link here
    snippetOptions: {
      ignorePaths: "wp-admin/**"
    }
  });
  done();
};
export const reload = done => {
  server.reload();
  done();
};

Upvotes: 0

Views: 1063

Answers (1)

viande
viande

Reputation: 97

I managed to solve the issue by updating the Home + Site URL to http://localhost:8888/mysite in the database.

And I added http:// to proxy on my gulpfile.

  server.init({
    proxy: "http://localhost:8888/humblyhealthy", // put your local website link here

I think it re-initialized the browsersync server after that. Because, now when I go into the back-end to Settings > General : Home & Site URL are now automatically set to //localhost:3000/humblyhealthy.

Upvotes: 0

Related Questions