WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] htaccess help needed for site alias (5 posts)

  1. Bodhipaksa
    Member
    Posted 6 years ago #

    So, my site is at http://www.bodhipaksa.com. My wife's site is in a subdirectory called /consciousmom and there's some code in the htaccess file that sends people to that subdirectory when they're visiting http://www.consciousmom.net. Or at least it did until I moved my blog from a subdirectory (bodhipaksa.com/blog) to the root.

    Now her site still comes up, but without any styling, and it's impossible to log in. I'm assuming I need to make some change(s) to the htaccess file, which contains the following:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>
    # END WordPress
    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} consciousmom.net$ [NC]
    RewriteCond %{REQUEST_URI} !^/consciousmom/.*$
    RewriteRule ^(.*)$  /consciousmom/$1

    Any ideas? I know squat about htaccess!

  2. Bodhipaksa
    Member
    Posted 6 years ago #

    jdMorgan, a guru over at Webmasterworld, figured it out for me.

  3. krembo99
    Member
    Posted 6 years ago #

    any cahnce we will get to hear how ?

  4. whooami
    Member
    Posted 6 years ago #

    JD is the preeminent regex guru on the web, I swear. Ive swapped a cpl emails with him over doing something custom for me. That site is a goldmine of info thanks to him.

  5. Bodhipaksa
    Member
    Posted 6 years ago #

    Ha! Now I get replies! Not complaining really -- htaccess is a minefield, and I'm glad people are interested.

    Here's the relevant bit of what's in the .htaccess file in my root ("darling" is JD''s code-name for my wife):

    RewriteEngine on
    #
    # Canonicalize my domain name
    # If requested hostname contains "bodhipaksa.com" (any case)
    RewriteCond %{HTTP_HOST} bodhipaksa\.com [NC]
    # but isn't *exactly* "www.bodhipaksa.com" (must be www and lowercase, with no appended dot or port numbers)
    RewriteCond %{HTTP_HOST} !^www\.bodhipaksa\.com$
    # then redirect to canonical domain
    RewriteRule (.*) http://www.bodhipaksa.com/$1 [R=301,L]
    
    # Canonicalize darling's domain name
    RewriteCond %{HTTP_HOST} consciousmom\.net [NC]
    RewriteCond %{HTTP_HOST} !^www\.consciousmom\.net$
    RewriteRule (.*) http://www.consciousmom.net/$1 [R=301,L]
    #
    # Darling's site (assuming it has its own .htaccess file at /consciousmom/.htaccess)
    RewriteCond %{HTTP_HOST} ^www\.consciousmom\.net
    RewriteCond %{REQUEST_URI} !^/consciousmom/
    RewriteRule (.*) /consciousmom/$1 [L]
    #
    # My site
    # BEGIN WordPress
    RewriteCond %{HTTP_HOST} ^www\.bodhipaksa\.com
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags