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.

How to use the INCLUDE function on .htm pages?

Discussion in 'PHP' started by Mr.Dog, Apr 3, 2013.

  1. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #41
    ...despite everything, I am able to use a code for rewriting from the "non-www" to the "www" version of my URL. Only the .htm removal is not working.
    SEMrush
    So the .htaccess is actually working/nothing blocks it.

    But this time the .htaccess is not in the public_html root, where files are, but above all folders.
     
    Mr.Dog, Apr 18, 2013 IP
    SEMrush
  2. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #42
    DeathShadow: I tried the 1st code that you gave me, but it gave me a 404 error upon reloading the same pages. A simple refresh gave me 404...

    The other codes seem to complex. I think I should try and see whether there is some Cpanel setting or other script (?) blocking it... But where?
     
    Mr.Dog, Apr 18, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,976
    Likes Received:
    1,635
    Best Answers:
    233
    Trophy Points:
    515
    #43
    If it's doing 404 from that, you probably didn't put the index.php and the .htaccess in the same directory, attempting a matching path in the URL.
     
    deathshadow, Apr 18, 2013 IP
  4. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #44
    I have an all .htm site. That site is all .htm.

    I got mixed up! :p
    I don't know anything about Apache coding and I only used .htaccess a coupple of times about 1-2 years ago.

    Meanwhile I tried this and it worked partially:


    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_fileNAME} !-d
    RewriteCond %{REQUEST_fileNAME} !-f
    RewriteRule ^(([^/]+/)*[^./]+)$ /$1.htm [L]


    The only thing this managed to do was to make it work without the .htm as well, but by standard it still appears with .htm at the end (annoying!). Now if I type in with- or without, it works. But by browsing through the pages, all appear with .htm.

    I just want the .htm to disappear...
     
    Mr.Dog, Apr 18, 2013 IP
  5. edduvs

    edduvs Well-Known Member

    Messages:
    394
    Likes Received:
    31
    Best Answers:
    3
    Trophy Points:
    110
    #45
    Thats happening because your <a href="some_link.htm"> tags are pointing the user some_link.htm, browser just does what you ask him to do in that <A> tag.
    Remove the .htm extension from all <a> tags.
     
    edduvs, Apr 18, 2013 IP
  6. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #46
    Mr.Dog, Apr 19, 2013 IP
  7. edduvs

    edduvs Well-Known Member

    Messages:
    394
    Likes Received:
    31
    Best Answers:
    3
    Trophy Points:
    110
    #47
    Have you done what I told you ? Remove .htm extension from the a tags in every page.
     
    edduvs, Apr 19, 2013 IP
  8. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #48
    If Mr.Dog is talking about his Spark Junction site (see sig) he appears to have multiple folders containing index.htm which he is point to within his sites menus and footer links, as for stories again he appears to linking story_name.htm

    He needs to remove index.htm from his menu and footer links and use the htaccess code for others, appending his links without .htm

    Ideally someone should offer 5mins to fix his site... this is page 3 of this thread:(

    OT @edduvs nice to see you back :) did you enjoy your ban break ?
     
    MyVodaFone, Apr 19, 2013 IP
  9. edduvs

    edduvs Well-Known Member

    Messages:
    394
    Likes Received:
    31
    Best Answers:
    3
    Trophy Points:
    110
    #49
    @MrDog, please mail me with some FTP access and I'll fix your issues.
    @MyVodafone, frankly I have no clue what that ban was for, some duplicate thread (I didn't make any thread lately though), but whatever.
     
    edduvs, Apr 19, 2013 IP