1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mod Rewrite / Rewrite Engine

Discussion in 'Apache' started by DarrenC, May 27, 2004.

  1. #1
    I've included the script in the .htaccess folder, but how do I get it working so that when someone hovers over a link it shows the .htm rather than .php and so Google picks up the pages as .htm

    Darren :)
     
    DarrenC, May 27, 2004 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Make your a href link to the .htm file.
     
    digitalpoint, May 27, 2004 IP
    1 person likes this.
  3. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Quick Tip:

    you may also want to put in an Apache handler for htm that runs the php interpreter regardless.

    As soon as I use php I activate the apache handler so htm(l) pages get interpreted as well, there is a very small performance overhead but one can simply keep using .htm or plug in php into an htm page without any problem.

    Like in your case makes switching on of mod rewrite later much easier.

    M
     
    expat, May 28, 2004 IP
  4. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How will this affect a search using php pages?

    Obviously the search results are dynamically produced, so when you hover over the link you'd expect to see .htm(l) instead of .php.

    You say there is some Apache header? How does this work, all this is completley new to me.

    Thanks
    Darren :)
     
    DarrenC, May 28, 2004 IP
  5. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    most sites (xNIX / Apache) in the beginning are set up for php to rely on the ending php to engage the pre processor thus htm(l) pages are not processed using php.

    You can add this processing to virtually any ending you like.
    Thus by adding php processing to htm(l) the ending htm will be run through the preprocessor as well.
    In my experience one ends up using snipets of php on virtually all pages.

    Depending on what you run, your ISP, etc either you may have to ask the ISP or if for example you have cpanel and nix and apache it is under site maintenance apache handlers where you can add the php processing to htm and html.

    Again on a standard install you should be able to simply add
    .htm application/x-httpd-php but that's without waranty.

    Also depending on your set up you may also wish to add this for
    .shtml as a lot of set up's seem to have custom error pages available but these end in .shtml. Thus if you can generate custom error pages you can generate these using php routines to intercept, guide users and send yourself alerts.

    Regarding users expecting .htm link when hovering I don't think so as most shopping carts sites are using php thus the ending is OK.
    No engine of my knowledge has any problem with .htm or .php as an ending.

    Personaly I like to do all major pages as htm sort of hiding the fact that there maybe extensive preprocessing.

    Hope this helps and best of luck.
    M
     
    expat, May 28, 2004 IP
  6. wolfpack

    wolfpack Peon

    Messages:
    34
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Wait. There is a bigger performance hit -- for both your customers and your server -- than just the file getting processed by the PHP interpreter. This also causes Apache to send the whole page every time the customer returns to the page, instead of just replying to the request with a status of 304 ("the page hasn't changed, your copy is still good").

    For some this will be minimal; for me it's a significant hit. Depends on file size and how visitors browse the site.

    If someone knows how (conditionally) to tell Apache to reply with 304 to requests for a page that it PHP-processes, that would be exeremely useful to me.
     
    wolfpack, May 28, 2004 IP
  7. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You are right that after the original bug apache resends the page but in travel and similar fast moving environments I rather send a new page, graphical elments get cached anyway.

    I use php caching for serious traffic (>5000 pages min) but here is a link to a 304 script http://ontosys.com/php/cache.html

    Cheers
    M
     
    expat, May 28, 2004 IP
  8. wolfpack

    wolfpack Peon

    Messages:
    34
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thank you!
     
    wolfpack, May 28, 2004 IP
  9. cannyinfotech

    cannyinfotech Guest

    Messages:
    105
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    you can rename your HTML file to htm that also will work similar to HTML
     
    cannyinfotech, Jan 30, 2009 IP
  10. starangel

    starangel Notable Member

    Messages:
    164
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    208
    #10
    rename your php files to htm if they only output html contents.
     
    starangel, Feb 5, 2009 IP