Welcome to WebmasterWorld Guest from 35.153.73.72

Forum Moderators: bakedjake

Message Too Old, No Replies

SSI without .shtml extention

How is this configured?

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

New User

10+ Year Member

joined:May 21, 2003
posts:26
votes: 0


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.

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

Full Member

10+ Year Member

joined:Nov 17, 2002
posts:313
votes: 0


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

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

New User

10+ Year Member

joined:May 21, 2003
posts:26
votes: 0


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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 21, 1999
posts:2141
votes: 0


There's an ongoing discussion here [webmasterworld.com] that may be useful to you.
4:25 pm on Aug 17, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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>

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

New User

10+ Year Member

joined:May 21, 2003
posts:26
votes: 0


Jim,

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

Thanks,
Joshua

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

Junior Member

10+ Year Member

joined:Sept 16, 2000
posts:122
votes: 0


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...]