Support » Fixing WordPress » Using a ~ in the address to link to a WP blog…

  • I was shown today that, as long as someone uses ~ges, things work fine.. but if, for some reason, like Blogger’s codebase, something translates the ~ to %7E, you get a 404 error. I’m confused, as %7E is the encoding *for* a ~. Is there something I can do to have WP recognize this properly? I’m running WP2.0.1 on Apache 2.0.55, and PHP 4.4.2…

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • This has nothing to do with WP. You need to configure Apache either using Directory Aliases, or better yet Virtual Hosts.

    Check out the following links for more info:


    Hi.. um.. I have the home directory stuff working. Perhaps I wasn’t clear.

    The URL is this *WORKS*! Honest–it does!

    Now, someone tried to link to me, but their software (Blogger) changes the ~ to a %7E (% 7 E in case it’s not showing), and tries to pass that on as the URL. Instead of WP reading the %7E, and going “Oh yeah, that’s a ~” it’s going “Oh this isn’t the right URL, so this is a 404!”

    Hence my original question… Thank you for your reply, however. 🙂

    I’m going to see if I can recreate this: <–this works <–this doesn’t…

    I realize that your website works with ~. The problem is that most systems will usually translate things like ~ ( ) and other characters into their ASCII value. Thats just how it works.

    You could just as easily fix this by creating a “virtual host” or a subdomain line

    It is generally inadvisable to have “~” in the URL unless you’re using the website on an internal network.


    I understand your opinion on ~ in URLs. It is, however, the default Userdir behavior on an Apache installation. The %7E and ~ are transparent to Apache–it’s specifically WP that is reading %7E and ~ as being different. :-/

    But, I thank you for your reply. I guess I’m going to have to live with WP’s behaviour on this for now.


    Was this ever resolved? It’s plaguing me as well.

    Basically what I’m seeing happen is that a REQUEST_URI shows up as /%7Ewls/blog/, and while Apache it more than happy to deal with that, WordPress has some brain damage in recognizing that a URL with %7E in it is the same as one with a tilde in it.

    Like you, any links using a tilde work:

    And, like you, any links using the escape encoding do not:

    Obviously Apache is delivering up a WordPress template, meaning it’s found the directory. But it’s the WordPress code that can’t figure out the URL to pull up the correct entries.

    I’ve tried poking around with mod_rewrite rules as well as WordPress’s PHP code. At the moment I’m not having much luck, as I think the page determination code happens well before I get around to fixing the string to a familiar form.

    I came up with a simple one like hack that solved it, see for more detail.

    The gist is, inside index.php, insert this as the first line within the PHP tags:
    $_SERVER[‘REQUEST_URI’] = preg_replace( “/%7[Ee]/”, “~”, $_SERVER[‘REQUEST_URI’] );

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Using a ~ in the address to link to a WP blog…’ is closed to new replies.