Hide URL path EG /w/ with PHP or htaccess

I have a pesky WordPress site, installed in a directory called /w/ — in which cannot be rebuilt or migrated to a different location — YES, I know basically what I am asking and seeking is a hack, but that is all time affords and is actually something I’m curious about anyway.

If website is http://www.example.com/w/ — how can I either a.) alter / add to the WordPress default htaccess file or b.) maybe add something in PHP to the functions file? Or a anything else similar to uploading a script or PHP snippet to the server? – to remove or hide the /w/?

Read More

Problem is — before you get all http://codex.wordpress.org/ on me; this particular website has so many customizations, plugins, etc — that most options listed there or elsewhere cause more problems (already tried several, took hours to revert back), because it just moves part of the website causing more issues in the long run — so it’s either this hack or a complete re installation rebuild, which I can’t do due time.

Update – Cue Violin, nothing works


Tried @David’s technique by creating new .htaccess file in root directory behind /w/ and nothing occurred, page down in Chrome, Firefox reports ‘Server attempting to redirect in a way which will never complete’)

RedirectMatch 301 ^/w/(.*)$ http://www.tonsofbeers.com/$1

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

Related posts

Leave a Reply

1 comment

  1. How about RedirectMatch?

    RedirectMatch 301 ^/w/$ http://www.tonsofbeers.com/
    

    EDIT:

    If you want to redirect all files, not just the root:

    RedirectMatch 301 ^/w/(.*)$ http://www.tonsofbeers.com/$1
    

    EDIT 2:

    Or using rewrite:

    RewriteEngine On
    RewriteRule ^w/(.*)$ http://www.tonsofbeers.com/$1 [L,R=301]