Closed GaryJones closed 4 years ago
I don't want to include steps for .htaccess
because it makes sense only for Apache users.
I myself often use Nginx, and there are a lot of other web servers out there.
Moreover, I want to make WP Starter as more flexible as possible: things that can independendly set by users without affecting functionality, should be allowed, without forcing anything that is not necessary.
For this reason I don't want to remove that part of the url by defaut (it can be already customized based using wordpress-install-dir
in composer.json
.
IMO, a documentation entry in readme / web site is enough for me, and who cares can remove that part of the url using the method allowed by their web server software.
@GaryJones for Nginx it should be around the lines
location /wp {
rewrite ^/wp(/.*)$ $1 last;
}
With Apache and mod_rewrite
enabled, it should be something like
RewriteEngine ON
RewriteRule ^wp(/.*)$ $1 [L,QSA]
Thanks. Documentation on the website would be sufficient.
@GaryJones Just file a pull request for that, please :)
Is your code above definitely correct? As that's what I'll blindly include in the PR :-)
@GaryJones just out of my mind, the other half from a highly upvoted answer on SO. Please test that upfront.
No idea why I closed this – maybe I assumed that @GaryJones would file either a PR or open another issue?
I tried the nginx rule but it did not work but I found one that does
rewrite ^/(wp-.*.php)$ /wp/$1 last;
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;
Hey @grappler, Thanks for providing these!
I have two questions:
/wp-admin
. Is that not needed in your case?.env
or wp-config.php
for these to work?In the link you've posted, there's a third rule that comes before the ones you've posted, which looks like it is adding a trailing slash to /wp-admin. Is that not needed in your case?
I was running it on VVV and that rule was already there.
Did you need to adapt
.env
orwp-config.php
for these to work?
I just changed both site and home url to be the same without wp
at the end. You can either make this change in the wp-config.php
with the constants or change the values in the database.
I might as well add what I use for apache too. This is part of the whole WordPress rewrite rules.
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]
In v3 we have optional steps... maybe after some tests it is the case to add a step that does this.
In v3 we have optional steps... maybe after some tests it is the case to add a step that does this.
@gmazzap is v3 branch safe enough to try using in production already?
https://github.com/wecodemore/wpstarter/projects doesn't seem to list v3 with any due date indication, so not sure how far things are or aren't.
@lkraav no it is not yet ready. It is heavily in development and during the same day could bè broken several times. I will merge into "dev" when I'll be confident it will be ready for tests in the wild.
Did this issue become resolved by v3 beta?
There's no issue :) We need to document how to obtain this, not sure yet where/how. I'm not 100% sure it fits the main documentation.
Just drop that here: I use these rewrite rules which also fits for multisite configurations with path segments as part of site-urls: https://github.com/inpsyde/wpstarter-boilerplate/blob/master/templates/.htaccess.example Never had any issues with these on several projects.
Documented here: https://github.com/wecodemore/wpstarter/blob/dev/docs/03-WordPress-Integration.md#admin-url
Closing.
Thanks you all, expecially @dnaber-de
With WP core inside
/wp/
, the admin URLs become prefixed with/wp/
. While this could be changed to/app/
or/admin/
, is there a way to just hide it altogether? Perhaps include steps for.htaccess
rewrite?