server-command icon indicating copy to clipboard operation
server-command copied to clipboard

Support pretty permalinks

Open drzraf opened this issue 6 years ago • 6 comments

Describe your use case and the problem you are facing

wp server does not handle wp-login.php and, more generally, any WP entry-point other than index.php

Describe the solution you'd like

Hardwiring entrypoints logic (or even parse the htaccess using PHP) in order to support them would make it.

A fully browsable WordPress instance off Apache/nginx/php-fpm would be handy in Q&A situations/simulations. The (probably < 100) lines needed may be worth it.

If login.php is requested by the client, that file would be require'd dynamically. Some tweaks to $_SERVER may be needed though in order to mimic mod_rewrite behavior.

drzraf avatar Jul 10 '19 01:07 drzraf

Hey, not the maintainer here: just a user.

I actually manage to reach http://localhost:8080/wp-login.php w/o any problem. 🤔

alessandro-fazzi avatar Jul 10 '19 11:07 alessandro-fazzi

Indeed, wp-login.php and other files work fine.

I think we're actually talking about pretty permalinks here.

Something like this might be necessary https://gist.github.com/scribu/4088244

lkraav avatar Sep 12 '19 11:09 lkraav

I forgot to say I'm using bedrock where the layout is a bit different.

drzraf avatar Sep 13 '19 13:09 drzraf

WP-CLI already has such a router script, so not sure what's missing there 🤔

swissspidy avatar Nov 11 '23 10:11 swissspidy

Same problem. I've set up a test with:

sudo service mysql start
sudo mysql <<< "CREATE USER 'wpssguser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'wpssgpass';"
php ./wp-cli.phar core download --path=./wpssgblog --locale=en_US
php ./wp-cli.phar config create --path=./wpssgblog --locale=en_US --dbuser=wpssguser --dbpass=wpssgpass  --dbname=wpssgdb  --dbhost=127.0.0.1
php ./wp-cli.phar db create --path=./wpssgblog
php ./wp-cli.phar core install --path=./wpssgblog --url=wpssgblog.local --title="WP-CLI" --admin_user=wpcli --admin_password=wpcli [email protected]

Now I'm trying to get pretty permalinks:

php ./wp-cli.phar option set permalink_structure '/%year%-%monthnum%-%day%-%postname%/' --path=./wpssgblog
php ./wp-cli.phar post list --field=url --path=./wpssgblog

php ./wp-cli.phar server --host=127.0.0.1 --port=8080

# http://wpssgblog.local/wpssgblog/2024-01-28-hello-world/
# ^^^^^^^^^^^^ the above does not open, as does not open http://localhost:8080/wpssgblog/index.php/2024-01-28-hello-world/

vadimkantorov avatar Jan 28 '24 23:01 vadimkantorov

If this simple server supports pretty-links, rolling a simple SSG might be as easy as pointing wget --mirror at the local instance of this web server!

vadimkantorov avatar Jan 28 '24 23:01 vadimkantorov