Programatically adding <h1> into <title> using Apache

Discussion in 'Apache' started by Hendy_100, Dec 8, 2006.

  1. #1
    Hi Guys,

    Newby here. I was wondering if anyone could figure out a mod_rewrite of some sort that would automatically insert the H1 of the article into the Title tag.

    I have generic title tags across tens of thousands of pages and I would like to try and make the titles the same as the H1, automatically.

    Any help would be great.

    Thanks!!

    Hendy
     
    Hendy_100, Dec 8, 2006 IP
  2. Hendy_100

    Hendy_100 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I am under the gun with this one - any help would be great..
     
    Hendy_100, Dec 8, 2006 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    it wouldn't work anyway <title> is the browser name tag, can't change that font
     
    krakjoe, Dec 8, 2006 IP
  4. Hendy_100

    Hendy_100 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm sorry, I think I didn't explain the problem and solution I was looking for correctly.

    I am looking to add whatever the text that is located in the header tag, which happens to be an h1, and programmatically have that post this text in the title tag.
     
    Hendy_100, Dec 8, 2006 IP
  5. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #5
    To the best of my knowledge, you cannot do this with Apache without creating a module to do this kind of task.

    However, you can do this programmatically if you are using something like php and some kind of template system. In simple terms, grab the title of the document and insert that into the <title></title> field in the head of the page which is created for Apache to send out.

    If documents come from a database and the title, which goes between the <h1></h1> tags is in a separate field, capture that and replace <title></title> with <title>the title found in the database</title>.
     
    clancey, Dec 13, 2006 IP