Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    January 18th, 2005
    Posts
    161
    Helo Folks,

    How to make .htm files behave like .shtml witouh having to rename al the .htm files?.

    Thx,
    Andy

  2. #2
    Newbie
    Join Date
    January 18th, 2005
    Posts
    16
    The answer depends alot on the evironment your using. I'll take a shot at this assuming,

    1) You're using Apache
    2) All of your server side CGI (ie. the .shtml) include other files with the correct extension (ie, include('somefile.shtml') and NOT include('somefile.htm'))
    3) You don't have any normal .html files you want accessed by visitors

    Given the above, I would add the following to the .htaccess file of the document root.

    [cut]
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/.*?\.htm
    RewriteRule ^/(.*?)\.htm /$1\.shtml [L,QSA]
    [/cut]


    It changes every request for a html file into a request for a shtml file. Its not a very good solution but if you post more details, maybe we could come up with a better solution.

    Kpuc

  3. #3
    Defender of Truth, Justice and the Affiliate Way
    Join Date
    January 18th, 2005
    Location
    The Swamp
    Posts
    7,503
    If what you are doing is adding SSI to pages you have previously named with .htm and aren't wanting to rename them all, I cam across this code a bit back. It goes into your .htaccess file. If you put it in your root directory, then it will take care of all subdirectories you may have also.

    AddType text/x-server-parsed-html .html

    I haven't tried it yet though, but they said it was the fix to that problem.

    Keep Your Hands Off My Cookies

  4. #4
    Member
    Join Date
    January 18th, 2005
    Posts
    161
    thx guys

  5. #5
    Member
    Join Date
    January 18th, 2005
    Posts
    161
    What if I only want to implement this functionality on specific directory?.

  6. #6
    Full Member
    Join Date
    January 18th, 2005
    Posts
    480
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by cowcool:
    What if I only want to implement this functionality on specific directory?.<HR></BLOCKQUOTE>


    Put the .htaccess file in the directory you want.

  7. #7
    ABW Ambassador webmarm's Avatar
    Join Date
    January 18th, 2005
    Posts
    1,713
    Not all hosts will allow this, so be sure to check with your host.

    - - - - -
    42. Yup, the answer to life, the universe, and everything.

  8. #8
    Super Sh!t Stirrer SSanf's Avatar
    Join Date
    January 18th, 2005
    Posts
    9,944
    I have some .htm files and some .html files. Will this work on both?

    [cut]
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/.*?\.htm
    RewriteRule ^/(.*?)\.htm /$1\.shtml [L,QSA]
    [/cut]

    Do you include the "[cut]" and "[/cut]" when you past it into the file?

    The Wolf Credo: Respect the elders. Teach the young. Cooperate with the pack. Play when you can. Hunt when you must. Rest in between. Share your affections. Voice your feelings. Leave your mark.

  9. #9
    Full Member
    Join Date
    January 18th, 2005
    Posts
    339
    Hello All,

    A while back, I needed this capability for a sub-directory to treat ALL HTM and HTML docs as SHTML. Note that All HTML docs will be pre-processed as SHTML.

    Place this code into a .HTACCESS file in the directory desired.

    XBITHack On

    I only have this one line entry in the .HTACCESS file. Works fine on my site. Try it.

    Jim in Texas

    Patriot, Army Type, One Each...
    USA - This We'll Defend

  10. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: May 21st, 2009, 05:14 AM
  2. All your files belong to us - Files Held Ransom
    By zendozen in forum Midnight Cafe'
    Replies: 1
    Last Post: May 26th, 2005, 11:55 AM
  3. Changing old pages from .htm to .shtml
    By SSanf in forum Midnight Cafe'
    Replies: 10
    Last Post: March 12th, 2004, 10:32 PM
  4. changing files from .html to .shtml
    By perfectG in forum Search Engine Optimization
    Replies: 8
    Last Post: March 18th, 2003, 03:16 AM

Posting Permissions

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