How to remove “admin.php?page=” from wp-admin using .htaccess?


I’m looking to use .htaccess to rewrite admin page URLs. I’d like to change it from:


Right now I have:

RewriteEngine On

RewriteRule ^members$ admin.php?page=members& [L,E=CLEAN_CONTACT_URL:1,QSA]
RewriteRule ^add-members$ admin.php?page=add-members [L,E=CLEAN_CONTACT_URL:1,QSA]
RewriteRule ^delete$ admin.php?page=delete& [L,E=CLEAN_CONTACT_URL:1,QSA]

RewriteCond %{QUERY_STRING} ^page=(.*)$
RewriteRule ^admin.php$ /wp-admin/%1?%2 [R,L]

Which changes it to:

I don’t mind adding each ‘section’ (e.g. members / add-member / delete) to my .htaccess. Although, if there is a better way, I’d be happy to see it!

I’m using internal and external redirections, so that when you click on a admin URL and it goes to wp-admin/admin.php?page=somewhere, it rewrites the URL for the browser, and then finds the rewritten URL. I would like to use ‘pretty’ admin links. Example:

Is easy to remember and intuitive. Eventually, I will rename /wp-admin to /user as well.

, , Jeff 2 years 2019-12-31T08:38:42-05:00 0 Answers 100 views 0

Leave an answer