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

Htaccess Question

Discussion in 'Cloaking and Content Generators' started by contentfreak, Dec 5, 2010.

Tags:
  1. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    hey guys

    I have a question

    I want to make via htaccess redirect 301 so that anyone who goes to site.com/blog/* lands on site.com/new-blog/

    Redirect 301 /blog/ http://www.site.com/new-blog/ worx alright but keeps the extension

    if they go to /blog/1.html then it will send them to /new-blog/1.html which is obviously a 404

    so how do i make them all land in the front page?

    Thnx!!!!!
     
  2. CyrusVirus

    CyrusVirus BANNED BANNED Premium Member

    Joined:
    Aug 20, 2009
    Messages:
    1,110
    Likes Received:
    686

    depending on who your host is, you can probably do it from the cpanel, quite easily actually. look for the domain redirection.
    as far as htaccess goes. im not to savvy in that field.
     
    • Thanks Thanks x 1
  3. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    thnx for that man, i didn't know that was possible thru hosting, can u explain how to do that from hostgator's cpanel?

    also if anyone else knows how to do it through htaccess, i prefer htaccess solution

    thnx
     
  4. CyrusVirus

    CyrusVirus BANNED BANNED Premium Member

    Joined:
    Aug 20, 2009
    Messages:
    1,110
    Likes Received:
    686

    lol yeah, go into the cpanel, go down to the domains bar, and look for "redirects"
    click it... you know you want to.

    and 301 it . that was easy
     
  5. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    ok, tested it and it does the same like i did with the htaccess in the beginning
    still if someone goes to old-blog/1 it will redicret to new-blog/1 which is 404
     
  6. lablinks

    lablinks Senior Member

    Joined:
    Apr 22, 2010
    Messages:
    926
    Likes Received:
    171
    add another htaccess in the new folder
    ErrorDocument 404 /404.htm (modify to your page)

    or use "mod rewrite" google it
     
    • Thanks Thanks x 1
  7. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    Yes, use Mod Rewrite.

    Try this

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^blog/* /new-blog/index.html
    Edit: your original regex should work within Rewrite
     
    • Thanks Thanks x 1
    Last edited: Dec 5, 2010
  8. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    TA Crazy
     
  9. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    it still dont go to main page but to 404
     
  10. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    Gimme a sec

    Look back at my original post.
     
    Last edited: Dec 5, 2010
  11. contentfreak

    contentfreak Registered Member

    Joined:
    Jun 13, 2010
    Messages:
    82
    Likes Received:
    19
    worx!!!

    RewriteRule ^blog/* /new-blog

    needed to loose the extension, mistake on my hand

    thnx alot
     
    Last edited: Dec 5, 2010