.htaccess redirect to www with wordpress in a /blog folder?

Discussion in 'Apache' started by natekapi, Mar 29, 2007.

  1. #1
    Wordpress is set up at www.domain.com/blog/ on one of my domains. I thought it would be easy to get domain.com/blog/ to properly forward all requests to the www version, but I'm having some problems. Can anyone help? This is what I have been trying.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    </IfModule>
    # 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
    Code (markup):
     
    natekapi, Mar 29, 2007 IP
  2. paidhosting

    paidhosting Peon

    Messages:
    4,822
    Likes Received:
    483
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try

    <IfModule mod_rewrite.c>
    Options -Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ http://www.urdomain.com/$1 [R=301,L]
    </IfModule>
    # 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
    Code (markup):
     
    paidhosting, Mar 30, 2007 IP
  3. natekapi

    natekapi Peon

    Messages:
    527
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That didn't work unfortunately. I got a 500 error code.
     
    natekapi, Apr 1, 2007 IP
  4. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    
    
    #is what is below generated by wp? If yes then leave it otherwise remove it.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    </IfModule>
    
    # END WordPress
    
    Code (markup):
     
    abdussamad, Apr 5, 2007 IP
  5. natekapi

    natekapi Peon

    Messages:
    527
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you!!
     
    natekapi, Apr 5, 2007 IP