helped need with htaccess problem

Discussion in 'Programming' started by the zoo keeper, Apr 23, 2007.

  1. #1
    forgive me if posted in the wrong section.

    I am in the process of moving all my domains over and redoing a lot of work, however the current domains have several thousand pages listed in the search engines and when i move them i will lose all this.


    At the moment all my website pages are set up as subfolders rather than 'pages' by this i mean that they are created as domain.com/page1 domain.com/page2 and so on, this is how they appear in google etc. Im in the process of redoing the sites with some other software but it makes the pages with html extentions, ie domain.com/page1.html

    The main problem i am getting from this is because im changing the file type/set up all the pages which are listed and ranked very well and spidered heavily will not work.

    I need to see if i can do something using htaccess which would forward all the clicks on the listed pages (ie domain/page1/) to the new location (domain.com/index.htm) i would also need to be able to have spiders following this redirect.

    Is this doable? Sorry i know very little at all about htaccess and programing in general so any help would be most welcome

    Regards
    Carl
     
    the zoo keeper, Apr 23, 2007 IP
  2. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    ErrorDocument 404 /404handler.php
    ErrorDocument 403 /404handler.php

    Add this to your htaccess and do some programming in 404handler.php this will work.
    If you are facing problem in 404handler programming ask I will be here to help you.
     
    Subikar, Apr 23, 2007 IP
  3. the zoo keeper

    the zoo keeper Guest

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks thats great, i can add that to the bottom of my htaccess, however sorry but i really do know very little about programing (my background is web marketing rather than development) what is a 404handler?

    thanks
    carl
     
    the zoo keeper, Apr 23, 2007 IP
  4. Jim_

    Jim_ Peon

    Messages:
    72
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Subikar's method would require you to write a PHP script (in this example, named 404handler) which would parse and redirect the user according to the url.

    The proper way to redirect your users would be to do it all within the .htaccess file.

    One way to do this would be to do it individually for each page. Your .htaccess file would look like this:
    or if all your pages are named in the same way, you could do the same thing in one line like this:
    In this example, a simple regular expression is used. (.*) finds any matching string. and it is placed into the new url by using $1.
     
    Jim_, Apr 23, 2007 IP
  5. the zoo keeper

    the zoo keeper Guest

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks ill give it a go
     
    the zoo keeper, Apr 23, 2007 IP