wordpress - htaccess: How to prevent recursive redirects? -


here's setup:

wordpress , webmail client installed in same directory. webmail client accessible through 2 urls:

  • www.server.com/webmail

    (the directory in installed.)

  • www.server.com/wp-admin/admin.php?page=webmail-plugin

    (a wordpress plugin displays webmail client in iframe inside wordpress admin.)

now i'd have webmail client accessiable through url www.server.com/wp-admin/admin.php?page=webmail-plugin , block direct access (from user) www.server.com/webmail.

in other words: if user tries access webmail client through www.server.com/webmail should redirected www.server.com/wp-admin/admin.php?page=webmail-plugin (which forces user log in first). however, wordpress plugin must still have access www.server.com/webmail able display webmail client inside iframe.

can configured through .htaccess? if so, how?

a little background information: i'd security reasons: wordpress secured various means, webmail client supports basic authentication , easiest way prevent issues webmail client hide behind wordpress - i.e. having non of interface (especially not login page) exposed outside wordpress.

edit: why simple redirect /webmail /wp-admin doesn't work:

the difficulty wordpress , webmail client running on same host. , when wordpress displays webmail client loads www.server.com/webmail. therefore, redirecting www.server.com/webmail www.server.com/wp-admin/admin.php?page=webmail-plugin cause recursion:

  1. when webmail interface should displayed inside iframe, wordpress tries load www.server.com/webmail.
  2. but request gets redirected www.server.com/wp-admin/admin.php?page=webmail-plugin, causing whole wordpress backend displayed (nested) inside iframe.
  3. the nested wordpress backend again tries display webmail client (1.), again gets redirected wordpress backend, , on....

can recursion issue fixed through .htaccess? if not, other options suggest?

your advise highly appreciated. thank you!

rewriteengine on  rewritecond %{http_host} ^mail.server.com [nc] rewriterule ^(.*) http://server.com/wp-admin/admin.php?page=webmail-plugin [l,r] 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -