Mod_Rewrite Permalink Problem

Discussion in 'Apache' started by kahsoon, Jan 18, 2007.

  1. #1
    I've put this mod_rewrite code in my .htaccess so that it will redirect funnyall.com to www.funnyall.com, it works but the problem is when i type http://funnyall.com/2006/12/05/funny-all-1/ it will redirect to http://www.funnyall.com/index.php

    Is there any way to fix this problem so that when i type in http://funnyall.com/2006/12/05/funny-all-1/ it will redirect to http://www.funnyall.com/2006/12/05/funny-all-1/

    Below is my code:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^funnyall\.com$ [NC]
    RewriteRule ^(.*)$ http://www.funnyall.com/$1 [R=301,L]
    Code (markup):
    P/S: I'm using WP version 2.0.2
     
    kahsoon, Jan 18, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    What's your complete code, with the WP mod_rewrite code?
     
    Nintendo, Jan 18, 2007 IP
  3. kahsoon

    kahsoon Peon

    Messages:
    110
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^funnyall\.com$ [NC]
    RewriteRule ^(.*)$ http://www.funnyall.com/$1 [R=301,L]
    Code (markup):
    This is everything in my .htaccess
     
    kahsoon, Jan 18, 2007 IP
  4. angisson

    angisson Banned

    Messages:
    201
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #4
    RewriteCond %{HTTP_HOST} !^www\.funnyall\.com [NC]
    RewriteRule ^(.*) http://www.funnyall.com/$1 [L,R=301]

    try that?

    not sure if it will work.. but try? :)
     
    angisson, Jan 18, 2007 IP
  5. kahsoon

    kahsoon Peon

    Messages:
    110
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Tried it but not working.
     
    kahsoon, Jan 18, 2007 IP
  6. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #6
    Try it with them switched around, with the redirect first.

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^funnyall\.com$ [NC]
    RewriteRule ^(.*)$ http://www.funnyall.com/$1 [R=301,L]

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
     
    Nintendo, Jan 19, 2007 IP
  7. kahsoon

    kahsoon Peon

    Messages:
    110
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    OH MY LORD it works!!! Thank you so so much Nintendo! You have no idea how happy i am now. By the way is it ok to put the redirection code on top of the wordpress code?

    Another thing is what is this code? It appears in all my .htaccess when i create a website account. Can i remove it?

    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.funnyall.com
    AuthUserFile /home/funnyall/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/funnyall/public_html/_vti_pvt/service.grp
    Code (markup):
     
    kahsoon, Jan 19, 2007 IP
    Nintendo likes this.
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    It works, there for it's OK!

    Ack...that code is FrontPage!!! If you don't use FrontPage, you can probably dump it.
     
    Nintendo, Jan 19, 2007 IP
  9. kahsoon

    kahsoon Peon

    Messages:
    110
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Awesome thanks!
     
    kahsoon, Jan 19, 2007 IP