1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

plz. Help with .htaccess file

Discussion in 'White Hat SEO' started by yusuf0024, Dec 26, 2010.

  1. yusuf0024

    yusuf0024 Regular Member

    Joined:
    Sep 13, 2009
    Messages:
    289
    Likes Received:
    63
    hello this is my site and its .htaccess file is as below,
    RewriteEngine on

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 116.75.146.62
    deny from 122.170.14.113
    deny from 122.170.14.100/30
    deny from 122.170.14.104/29
    deny from 122.170.14.112/28
    deny from 122.170.14.128/28
    deny from 122.170.14.144/32
    deny from 59.95.225.185
    deny from 59.95.225.170/31
    deny from 59.95.225.172/30
    deny from 59.95.225.176/29
    deny from 59.95.225.184/30
    deny from 59.95.225.188/31
    deny from 59.95.225.190/32

    deny from 117.201.103.57
    deny from 117.201.97.248
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]


    I WANT TO DO 301 REDIRECT FROM NON WWW TO WWW.MYDOMAIN.COM...

    IS THIS CORRECT MODIFICATION FOR THIS .HTACCESS FOR SEO OR HAVE TO DO MORE MODIFICATION IN THIS, PLS HELP ME REGARD THIS.ANY KIND OF ADVICE IT WIL HELPFULL FOR ME IN THIS FIELD,AND EVEN I DONT HAVE ANY IDEA ABOUT IT. THANK U
     
  2. extremephp

    extremephp BANNED BANNED

    Joined:
    Oct 19, 2010
    Messages:
    1,293
    Likes Received:
    1,274
    http://www.blackhatworld.com/blackhat-seo/white-hat-seo/258855-redirection-301-htaccess-tutorial.html

    That Would solve your trouble :)

    P.S : Next time you look for something, search for it first :)


    ~ExP~
     
    • Thanks Thanks x 1
  3. Skywalker

    Skywalker Junior Member

    Joined:
    Nov 2, 2009
    Messages:
    174
    Likes Received:
    43
    Occupation:
    Jedi
    Location:
    Tatooine
  4. arnoudjansen

    arnoudjansen Registered Member

    Joined:
    Jan 2, 2010
    Messages:
    69
    Likes Received:
    34
    Location:
    Far away
    # withouw WWW to WWW
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
    # index.php to main site
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]


    The first rule rewrites the non www with a 301 redirect to www.
    The second rewrites: www.yourdomain.com/index.php to www.yourdomain.com/

    Merry cristmas
     
    • Thanks Thanks x 1
  5. yusuf0024

    yusuf0024 Regular Member

    Joined:
    Sep 13, 2009
    Messages:
    289
    Likes Received:
    63
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
    # index.php to main site
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]
    </IfModule>

    # END WordPress

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 116.75.146.62
    deny from 122.170.14.113
    deny from 122.170.14.100/30
    deny from 122.170.14.104/29
    deny from 122.170.14.112/28
    deny from 122.170.14.128/28
    deny from 122.170.14.144/32
    deny from 59.95.225.185
    deny from 59.95.225.170/31
    deny from 59.95.225.172/30
    deny from 59.95.225.176/29
    deny from 59.95.225.184/30
    deny from 59.95.225.188/31
    deny from 59.95.225.190/32

    deny from 117.201.103.57
    deny from 117.201.97.248
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    is this correct ????????????
    i also need to edit index.php ?

    And 1 more qustion what is this

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
     
    Last edited: Dec 26, 2010
  6. arnoudjansen

    arnoudjansen Registered Member

    Joined:
    Jan 2, 2010
    Messages:
    69
    Likes Received:
    34
    Location:
    Far away
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 116.75.146.62
    deny from 122.170.14.113
    deny from 122.170.14.100/30
    deny from 122.170.14.104/29
    deny from 122.170.14.112/28
    deny from 122.170.14.128/28
    deny from 122.170.14.144/32
    deny from 59.95.225.185
    deny from 59.95.225.170/31
    deny from 59.95.225.172/30
    deny from 59.95.225.176/29
    deny from 59.95.225.184/30
    deny from 59.95.225.188/31
    deny from 59.95.225.190/32

    deny from 117.201.103.57
    deny from 117.201.97.248
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://mydomain.com$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com$ [NC]
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    # withouw WWW to WWW
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
    # index.php to main site
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]

    Do it like that.
    You don't need to edit the index.php

    if a # stand before a line it means it is a comment hope this helped
     
    • Thanks Thanks x 1
  7. yusuf0024

    yusuf0024 Regular Member

    Joined:
    Sep 13, 2009
    Messages:
    289
    Likes Received:
    63
    Thank you very much.
    its work perfectly.
    i add this on my .htaccess file

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>

    deny from 116.75.146.62
    deny from 122.170.14.113
    deny from 122.170.14.100/30
    deny from 122.170.14.104/29
    deny from 122.170.14.112/28
    deny from 122.170.14.128/28
    deny from 122.170.14.144/32
    deny from 59.95.225.185
    deny from 59.95.225.170/31
    deny from 59.95.225.172/30
    deny from 59.95.225.176/29
    deny from 59.95.225.184/30
    deny from 59.95.225.188/31
    deny from 59.95.225.190/32

    deny from 117.201.103.57
    deny from 117.201.97.248

    #RewriteCond %{HTTP_REFERER} !^http://my domain/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://my domain $ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.my domain.com/.*$ [NC]
    #RewriteCond %{HTTP_REFERER} !^http://www.my domain.com$ [NC]
    #RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    # withouw WWW to WWW
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^my domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.my domain/$1 [R=301,L]
    # index.php to main site
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.my domain/ [R=301,L]
     
    Last edited: Dec 26, 2010
  8. yusuf0024

    yusuf0024 Regular Member

    Joined:
    Sep 13, 2009
    Messages:
    289
    Likes Received:
    63
    Last edited: Dec 27, 2010