Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reallycoolobjects.com #55

Closed
flexseth opened this issue Apr 19, 2024 · 6 comments
Closed

reallycoolobjects.com #55

flexseth opened this issue Apr 19, 2024 · 6 comments

Comments

@flexseth
Copy link

flexseth commented Apr 19, 2024

Blueprint idea: make a website that spoofs the URL bar

User goes to reallycoolobjects.com and it looks like their website

Their hosts file is tricked, but it makes demonstration so much better.

The challenge

In any case, recreating this huge knowledge base in Playground’s documentation site seems like a bad idea.

Here's a bad idea....

@ironnysh - you're good with wp-now ;)

I've got a scenario for you:

  • create theme1 folder
  • create theme2 folder
  • change localhost settings to spoof hosts via a blueprint

The steps should include how to set up VS Code for the instance.

And yes, the user will have to edit their hosts file.

End result

  • Playground that spoofs the URL bar so the user sees a "live" site
  • Show how to "spoof" a URL in the address bar by editing the hosts file

ie: user's website is called Really Cool Objects

the URL bar could show reallycoolobjects.com

Why?

Being able to customize the perceived URL is a huge benefit in many ways.

  • Differentiate between live, staging, and development sites
  • show something that looks like a "live" site - think new users
  • most modern platforms support changing the URL

Extra Credit

Show how to save developer workspaces in VS Code

Make theme1 go to dev.reallycoolobjects.com

@ironnysh
Copy link

Hi @flexseth, not sure I follow 😅 Can you elaborate on the why?

@adamziel
Copy link
Owner

Also, spoofing the hosts file from Playground isn't technically possible.

@flexseth
Copy link
Author

I tried getting this to work based on the instructions available in the wp-now documentation, did not seem to work.

Hosts file

## Playground ##
http://127.0.0.1:8881   http://myurl.wpnow:8881

blueprint

{
	"steps": [
		{
			"step": "defineWpConfigConsts",
			"consts": {
				"WP_HOME": "http://myurl.wpnow:8881",
				"WP_SITEURL": "http://myurl.wpnow:8881"
			},
			"method": "define-before-run"
		}
	]
}

npx command

npx @wp-now/wp-now start --blueprint=blueprint.json

result

This site can’t be reached
Check if there is a typo in myurl.wpnow.
DNS_PROBE_FINISHED_NXDOMAIN

errors

errors: 'PHP Warning:  Constant WP_HOME already defined in /var/www/html/wp-config.php on line 2\n' +
      'PHP Warning:  Constant WP_SITEURL already defined in /var/www/html/wp-config.php on line 3\n' +
      'PHP Warning:  Cannot modify header information - headers already sent by (output started at /var/www/html/wp-config.php:2) in /var/www/html/wp-login.php on line 504\n' +

notable

I ran this in "WordPress" mode - IE: no files or folders except the blueprint.json file.

@ironnysh
Copy link

Hey @flexseth, the hosts file should look like this (without the protocol and port number):

127.0.0.1       myurl.wpnow

Can you see if it works?

@flexseth
Copy link
Author

Hey @flexseth, the hosts file should look like this (without the protocol and port number):

127.0.0.1       myurl.wpnow

This works, but throws the error

Warning: Constant WP_HOME already defined in /var/www/html/wp-config.php on line 2
Warning: Constant WP_SITEURL already defined in /var/www/html/wp-config.php on line 3

Feel like this has been addressed somewhere.

I'll mark this as closed, there will probably be a good solution for handling URLs at some point.

@ironnysh
Copy link

@flexseth, you can try resetting the project (see wp-now README):
--reset

Probably better to open a separate issue in the playground-tools repo, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants