Forum Moderators: bakedjake

Message Too Old, No Replies

SSI without .shtml extention

How is this configured?

         

joshuakaufman

1:35 pm on Aug 17, 2003 (gmt 0)

10+ Year Member



I would like to change the URL format of files on my website from this:

[domain.com...]

to this:

[domain.com...]

But still use server side includes within my pages. I'm know that I can write rules to specify this in .htaccess but I couldn't find this specific example documented anywhere.

Here's an example that will allow SSI to be used in files with .html. Can I modify this to include files without an extention?

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

Thank you.

wruk999

3:09 pm on Aug 17, 2003 (gmt 0)

10+ Year Member



joshuakaufman,

I think you have to use an apache re-write rule to re-write from /pages.shtml to /page

If you search around this site, you should find some very useful threads on using rewrite.

wruk999

joshuakaufman

3:33 pm on Aug 17, 2003 (gmt 0)

10+ Year Member



wruk999,

Thanks but the rewrite rule is not my concern right now. I already know how I'm going to rewrite URLs. What I'm trying to find out is how I can tell Apache to allow SSI in pages, whether they have .shtml in their name or not.

DaveAtIFG

3:52 pm on Aug 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's an ongoing discussion here [webmasterworld.com] that may be useful to you.

jdMorgan

4:25 pm on Aug 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Josh,

You can try something like this:


Options -Indexes
AddType text/html .josh
AddHandler server-parsed .josh

RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*)$ /$1.josh [L]

Disable directory indexes.
Define a new file type.
Enable SSI parsing on that file type.
Rewrite any URI which does not contain a period to that file type.
(A separate RewriteCond is required as shown, since negative patterns are not available for backreference.)

Now any page you upload to your server with filetype ".josh" will be available via http when requested with or without the ".josh" file type, and will be parsed for SSIs.

You actually don't need to define a new file type, except to distiguish between files that will receive this special handling and those that won't. If you plan to have SSI on all pages, you can omit the steps of defining a new file type and adding a handler for it, and simply rewrite all files without an extension to ".shtml"

The above practice has pitfalls, such as the fact that directory indexes cannot be made available, and the added complexity of rewriting all requests for pages with SSI.

HTH,
Jim
<added> The reason all this is needed is that you can't add server parsing to a blank filetype. </added>

joshuakaufman

7:21 pm on Aug 17, 2003 (gmt 0)

10+ Year Member



Jim,

Thanks, I think that's everything I need to know.

Thanks,
Joshua

Gorufu

3:07 pm on Sep 4, 2003 (gmt 0)

10+ Year Member



The reason all this is needed is that you can't add server parsing to a blank filetype.

Text files without an extension can be parsed. XBitHack will parse all text files with the execute bit set.

Just use the following in .htaccess

XBitHack on

[httpd.apache.org...]