Forum Moderators: phranque

Message Too Old, No Replies

ForceType

         

jackdack

1:53 am on Aug 15, 2005 (gmt 0)

10+ Year Member



I want to use filenames with no extension. My host is happy to support the use of ForceType.
I'm using mainly .php and possibly some .htm files.

1. If I use ForceType can it apply to multiple file extension types (.php & .htm)?
2. Is the use of ForceType likely to impact other php apps/scripts already on the site e.g. I am using a phpbb forum (written in php)?
3. Any tricks or tips for client side of development working with files with no extension? I'm using DreamWeaver which doesn't seem to like no extension.

Thank you

jdMorgan

4:35 pm on Aug 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check out the documentaton [httpd.apache.org] -- You can force as many filetypes as you like. How you do this will depend on where you do it, though -- in httpd.conf, in .htaccess in your document root, or in .htaccess in a subdirectory.

One thing that will help is to remember that "things" inside your server are referenced by URL from the outside, but by filepath/filename from the inside. URLs and filenames need have absolutely nothing in common. Therefore, it is easier to conceptualize this process you're undertaking by thinking in terms of removing the filetype from the URLs. But that does not mean that you need to remove the filetype from the internal filepath.

ForceType works using filenames, not URLs, so that makes the job easier.

A lot of issues come into play here, such as how well-organized your site is. In order to avoid interference with other scripts and resources, you can limit the scope of application of ForceType by directory, by URL, and in many other ways. By way of a warning, your last resort should be the method of checking for file-or-directory-exists; Although commonly seen in examples, it is slow and inefficient, and should be avoided if possible.

Jim

encyclo

5:59 pm on Aug 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't really recommend the approach if you are dealing with static pages (ie. not database-driven or with rewritten URLs) or if you do not have access to a dedicated server. The only realistic approach to extensionless URLs with static content is to use Content negotiation [httpd.apache.org], but you won't usually find that on a shared server.

I know that extensionless URLs are sometimes recommended as an ideal, but in reality they come with no real benefits and several associated problems. As you have found, Windows and programs like Dreamweaver do not cope well with them, you are dependent on complex .htaccess rules, in ranking terms there is no advantage (and occasionally a disadvantage if the spider gets confused about the file type of a page), and anyway the end-users are reading your content not admiring your cruft-free URL structure.

I use extensions for most pages (almost always .htm or .html), even for URLs done with mod_rewrite. It is perhaps not the purest way, but it is often the best.

jackdack

11:10 pm on Aug 15, 2005 (gmt 0)

10+ Year Member



Excellent, thank you for both of these posts. It's given me a whole bunch more to consider and I'm thinking it's something I should probably leave for now (as tight deadline). I'll definitely pick it up again later. Thanks