• Resolved bayouj

    (@bayouj)


    Hello all,
    I would like to setup a DNS record admin.domain.com and have it redirect to domain.comn/wp-admin. I tried setting up the redirect in apache but when I got to that url, it just takes me to the main page of the site.
    Is there any way to accomplish this?
    thanks in advance!
    D

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can’t point the DNS record to a subfolder, only the domain. So, you’ll need an instance of Apache listening on admin.domain.com that has an Apache redirect to domain.com/wp-admin.

    Something like this should work:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://domain.com/wp-admin/$1 [R=301,L]

    Try a handy .htaccess generator like this: http://www.webconfs.com/htaccess-redirect-generator.php

    Thread Starter bayouj

    (@bayouj)

    Thanks!
    I enabled a2enmod and restarted apache, added
    <Directory “/var/www/html”>
    AllowOverride All
    </Directory>

    to the 000-default.conf file, and then finally added,

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} =staff.domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/wp-admin/$1 [r=301,nc]

    restarted apache and Bingo!
    Thanks again Mindctrl

    Glad to hear it! Thanks for the update.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Redirect to site/wp-admin’ is closed to new replies.