Please help with .htaccess redirects

Discussion in 'PHP' started by syedtaha, Apr 14, 2009.

  1. #1
    I have my website www.askwhiz.com
    The blog is at http://www.askwhiz.com/blog/

    I used to have a permanent redirect earlier. from www.askwhiz.com to www.askwhiz.com/blog/

    Accidently it got deleted.

    Now when i add the redirect. everything redirects to the blog folder which is http://www.askwhiz.com/blog/

    Even when i click http://www.askwhiz.com/forum/ i goto the blog folder.

    help apprciated.

    below is my .htaccess data

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^askwhiz.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.askwhiz.com$
    RewriteRule ^.*$ "http\:\/\/www\.askwhiz\.com\/blog\/" [R=301,L]
    Code (markup):
     
    syedtaha, Apr 14, 2009 IP
  2. snigster

    snigster Peon

    Messages:
    88
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try removing this bit

    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^askwhiz.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.askwhiz.com$
    RewriteRule ^.*$ "http\:\/\/www\.askwhiz\.com\/blog\/" [R=301,L]
    
    
    Code (markup):
     
    snigster, Apr 14, 2009 IP
  3. fear

    fear Banned

    Messages:
    3,750
    Likes Received:
    221
    Best Answers:
    0
    Trophy Points:
    205
    #3
    It is easy, you can even see it [R=301, L], 301 redirects, just remove
    And you are done.
     
    fear, Apr 14, 2009 IP
  4. syedtaha

    syedtaha Peon

    Messages:
    404
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    syedtaha, Apr 14, 2009 IP
  5. lachrymologist

    lachrymologist Active Member

    Messages:
    456
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    70
    #5
    try this:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^(www.)?askwhiz.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /blog/$1
    RewriteCond %{HTTP_HOST} ^(www.)?askwhiz.com.com$
    RewriteRule ^(/)?$ blog/index.php [L]
    Code (markup):
     
    lachrymologist, Apr 14, 2009 IP
  6. syedtaha

    syedtaha Peon

    Messages:
    404
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    @lachrymologist
    that code just gives me a blank index page and doesnt redirect when i type homepage url.
    i really need help on this.
    I ve started to lose traffic and pages are getting unindexed.
     
    syedtaha, Apr 16, 2009 IP