Forums

Using Mod Rewrite for nice URLs in wp-admin (7 posts)

  1. hami
    Member
    Posted 5 years ago #

    Does anyone know if it's possible, and also how, to use mod-rewrite to create nice URLs in the wp-admin part of WordPress?

    I would really like to change things like the following:
    http://mydomain/wp-login.php to http://mydomain/login/
    http://mydomain/wp-admin/ to http://mydomain/backend/
    http://mydomain/wp-login.php?redirect_to=/my-page/ to http://mydomain/login/redirect/my-page/
    http://mydomain/wp-login.php?action=/my-page/ to http://mydomain/logout/

    I'm pretty sure it's possible, but my mod_write and htaccess skills aren't good enough to work this out.

    Has anyone managed to get this working?

  2. hami
    Member
    Posted 5 years ago #

    Sorry that last example should have been this:
    http://mydomain/wp-login.php?action=logout to http://mydomain/logout/

  3. hami
    Member
    Posted 5 years ago #

    I'm guessing this can't be done then?

  4. whooami
    Member
    Posted 5 years ago #

    of course it can be done.

  5. hami
    Member
    Posted 5 years ago #

    Could you point me in the right direction then?

  6. whooami
    Member
    Posted 5 years ago #

    http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

    Im not going to do it for you -- thats not "pointing you in the right direction".

  7. hami
    Member
    Posted 5 years ago #

    I got part way there after finding this site: http://lyceum.ibiblio.org/2006/05/11/mod_rewrite-help-needed/

    I added the following below to the .htaccess file and it works for changing http://mydomain.com/wp-login to http://mydomain.com/login and changing http://mydomain.com/wp-admin to http://mydomain.com/dashboard. They worked as I wanted and changed the links everywhere in the backend.

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^dashboard/? wp-admin/index.php?%{QUERY_STRING} [L]
    RewriteRule ^login/? wp-login.php?%{QUERY_STRING} [L]

    I added some more RewriteRules after the above for changing http://mydomain.com/wp-admin/profile.php to http://mydomain.com/profile and changing http://mydomain.com/wp-login?action=logout to http://mydomain.com/logout, but they didn't seem to work the same way.

    RewriteRule ^profile/? wp-admin/profile.php?%{QUERY_STRING} [L]
    RewriteRule ^logout/? wp-login.php?action=logout?%{QUERY_STRING} [L]

    I'm a little out of my depth here, but making slow progress. Do you know a good reference site (written for the layman) on how the QUERY_STRING works in mod_rewrite?

    I think I'm getting close...

Topic Closed

This topic has been closed to new replies.

About this Topic