• Re: Settings -> General: WordPress address (URL) & Blog address (URL)

    Over a year ago I encountered a problem when placing a second WordPress install into a folder that was not physically inside the web server’s root folder. I created an alias, but it wasn’t served correctly due to the call to it being to a file instead of a folder. I could not enter a URL pointing to a folder, and when I forced the URL to be a folder name by adding a forward slash to the URL setting in the database, WordPress just didn’t work.

    I had to use mod-rewrite to work around it, or create a symbolic link, I forgot which I had to use. But today as I’m assisting another person with WordPress, I notice the same lack of support for assigning a root folder url.

    When I mention that WordPress isn’t quite up to speed with best practices, this URL problem is one example I use. After reading
    https://www.alistapart.com/articles/slashforward/ dated February 22, 2002, I realized that WordPress hasn’t changed this in all that time, and I thought I should mention it, for better or for worse.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I guess I’m confused as to why you’d put your WP install in a non web-root folder… It sounds like, to me, you’re trying to do this:

    /public_html/
                /blog (alias, points to /wordpress/)
    /public_ftp/
    /wordpress/

    Which I can’t fathom why. I mean, why not just do /public_html/blog/ from the get go? And from a quick glance at my site, it has the trailing / in there. So I’m confused what you’re trying to do and why it’s ‘failing.’

    Thread Starter beasts

    (@beasts)

    I guess I’m confused as to why you’d put your WP install in a non web-root folder…

    The sans-slashed link really occurs when installed into any location but root. Any second install of WordPress would not be in the same folder as the first, and let’s suppose the first is in the document root.

    The link (URL) in the #header section of WordPress will be sans-slashed. The URL appears to be constructed literally from the Wordlress settings Settings -> General: WordPress address (URL) & Blog address (URL), which does not allow the forward slash to be placed as the last character.

    I mean, why not just do /public_html/blog/ from the get go?

    When the second install is intended for a second user who shouldn’t have access to the files of the first, is a good example of when an alias is required.

    And from a quick glance at my site, it has the trailing / in there. So I’m confused what you’re trying to do and why it’s ‘failing.’

    It seems like your site has WordPress installed in the root document folder. What I’m trying to do is place a trailing / on the name of the folder (not the domain name) in the URL entered into the form in Wordlpress Dashboard -> Settings -> General: WordPress address (URL) & Blog address (URL)

    If you’re trying to replicate the conditions, you’ll need to install a second WordPress, or install the first somewhere else but web document root. But to see it fail to allow a trailing /, enter the more-correct trailing /’d URL and see what appears after pressing “Save Changes”.

    All I’m requesting is that the settings there should allow properly formed URLs with trailing / for folders, because under an edge case, it causes WordPress not to work. Best case, WordPress creates a link URL in the heading that requires a redirect.

    Thread Starter beasts

    (@beasts)

    Seems like it’s not just the link in the header section that’s sans-slash.

    The index meta link has the same annoying behavior, even for those sites that install WordPress in their document root:

    <link rel=’index’ title=’Ipstenu.Org’ href=’https://ipstenu.org&#8217; />
    Heading link: https://ipstenu.org/

    <link rel=’index’ title=’distractionware’ href=’https://distractionware.com/blog&#8217; />
    Heading link: https://distractionware.com/blog

    Notice the heading link in the first example correctly slashes after the domain name, to signal root folder. But its index meta link doesn’t.

    In the second case where WordPress is one folder in, it fails to slash after the folder name on both the index meta link and the heading link.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    It seems like your site has WordPress installed in the root document folder.

    Nope. My site has wordpress in /blog and I changed the blog address to be ‘root’. It pretends it’s in root via the normal method of running WP out of a sub-directory.

    If you want to get to my admin side, it’s https://domain.com/blog/wp-admin

    But no one sees that ?? The Blog Address is set to https://domain.com with no trailing slash and yet, it works fine.

    What I’m trying to do is place a trailing / on the name of the folder (not the domain name) in the URL entered into the form in Wordlpress Dashboard -> Settings -> General: WordPress address (URL) & Blog address (URL)

    That’s interesting. I went to a blog I have that IS in a sub-directory entirely, no acting in root, and it too has the trailing slash. It doesn’t on the permalinks of one, because I set them to /%postname%-%post_id% but if I put a / on the end, that shows up too.

    But to see it fail to allow a trailing /, enter the more-correct trailing /’d URL and see what appears after pressing “Save Changes”.

    Right, if I do that it goes back to https://domain.com/subfolder (no /). You are correct, sir ?? The thing is that when I go right to the URL, leaving off the /, it redirects to the one with the /, EVEN THOUGH my blog address doesn’t have the slash.

    It’s clearly fine if it’s a real subfolder and you only have the problem with an alias (which I’m not buggered to test since I don’t have that much free time today ?? ). If you’re having this problem with a ‘real’ sub folder, then it’s probably your server since I tested on three different ones and they’re all as expected.

    I mean, why not just do /public_html/blog/ from the get go?

    When the second install is intended for a second user who shouldn’t have access to the files of the first, is a good example of when an alias is required.

    Huh. I kinda see that, but I’ve never run into a situation where I had to do that. I mean, if I have two users, each one has their own login and access, and I just have each one use their own public_html folder and handle it on the backend via apache etc.

    That said, if you can’t do that for some reason, you could make user groups so joe:joe has access to one folder and jane:jane has access to the other. Let unix security handle it.

    Thread Starter beasts

    (@beasts)

    I don’t have that second WordPress install anymore, as it was just a sandbox for another user, and their own public_html folder was where it was installed, aliased to be the folder in the second install.

    See: https://codex.www.ads-software.com/Changing_The_Site_URL

    The examples there show not to place a trailing slash, and it’s not possible to do so, even though it’s more accurate to do so. In fact, other sections of documentation suggest placing trailing slashes on URLs in configuration areas, even after the initial domain where only the root folder is the target.

    So why does the WordPress -> Dashboard -> Settings -> General: WordPress address (URL) & Blog address (URL) fields not allow a trailing slash?

    The lack of trailing slash in the WordPress configuration causes the WordPress #heading div link and index meta tag to not have the trailing slash, and the only work-around is to hard-code the heading and index so the link contains the trailing slash and the web server doesn’t potentially fail when trying to serve the correct page when serving an alias to a folder. It fails to be aliased and looks for a file that doesn’t exist in the document root.

    Best case, the lack of trailing slash causes the server to redirect, and for anyone installing into a sub folder, the redirect will keep happening. Look at your WordPress site’s page source in the head, meta tag link rel=’index’, you’ll see that the slash isn’t there.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Keep it /’d.’ is closed to new replies.