WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] htaccess to move all site access except wp-admin?

[Resolved] htaccess to move all site access except wp-admin?

Viewing 2 replies - 1 through 2 (of 2 total)
  • jeremyduffy
    Member

    @jeremyduffy

    Ok, I think I figured it out, though I’m sure this is ugly and very wrong:

    rewritecond %{HTTP_HOST} ^www.d1.com$ [NC]
    rewritecond %{REQUEST_URI} ^…+ [NC]
    rewritecond %{REQUEST_URI} !^/wp-admin [NC]
    rewritecond %{REQUEST_URI} !^/index [NC]
    rewriterule ^(.*)$ “http\:\/\/d2\.com\/$1” [R=301,L]

    line one matches domain1
    line 2 requires that the part that comes after http://www.d1.com must be non-0 in length
    line 3 says it can’t be wp-admin and line 4 says it can’t be index

    This redirects only if it’s not just http://www.d1.com, http://www.d1.com/wp-admin, or http://www.d1.com/index.php (and it seems to work)

    jeremyduffy
    Member

    @jeremyduffy

    Nope, that didn’t work well at all. It ended up causing some kind of recursive loop on my page. I think it was actually due to another redirection of some kind, but either way things went bad.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] htaccess to move all site access except wp-admin?’ is closed to new replies.