Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie -- htaccess question

    Hi (first post)

    I would like to use htaccess to direct 404 traffic to the index page of a site – I am very new at this. The site has access to cPanel which offers the ability to modify the 404 response(s) – I have never done this before however. Currently 98% of the traffic is 404ed away from the sites. Also I am told that my hosting service should be contacted.

    I would like to do the following (XXX are page numbers):

    http://www.akilo.com/main-1_000XXX.html redirected to http://www.babysafari.us

    and

    http://www.akilo.com/main-2_000XXX.html redirected to http://www.akilo.com

    Thank you for your advice. Best regards, Frank, akilo55

  • #2
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Sounds like a job for mod_rewrite.
    Put
    Code:
    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule  main-1 http://www.babysafari.us [L]
      RewriteRule  main-2 http://www.akilo.com [L]
    </IfModule>
    in your .htaccess, if you want all URLs containing "main-1" or "main-2" redirected to the specified sites.

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Posts
    363
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Or RedirectMatch
    Code:
    RedirectMatch 301 ^/main-1_000[0-9]+\.html$ http://www.babysafari.us/
    RedirectMatch 301 ^/main-2_000[0-9]+\.html$ http://www.akilo.com/
    To send a 301 (permanent) redirect and only match /main-1_000XXX.html and /main-2_000XXX.html with mod_rewrite
    Code:
    Options +FollowSymLinks
    
    <IfModule mod_rewrite.c>
      RewriteEngine On
    
      RewriteRule ^main-1_000[0-9]+\.html$ http://www.babysafari.us/ [R=301,L]
      RewriteRule ^main-2_000[0-9]+\.html$ http://www.akilo.com/     [R=301,L]
    </IfModule>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •