homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

Static HTML Pages Without File Name Extensions
Moving CMS to static pages. 301 redirect only option? If so, which method?

 8:29 am on Jan 23, 2010 (gmt 0)

I am moving some pages, that up until now have been in a CMS package, into static HTML files.

Obviously, I want to keep the same URL structure. The CMS had been using 'SE friendly' URLs. However, the CMS had also been using 'pages' without file name extensions.

So, for example:


Obviously, I can simulate part of this structure with physical directories, but the html file itself needs an extension or my web server (Linux, CPanel hosted) just displays the pages as code.

Is there a way for me to keep the file structure exactly as it is, or will I have to create new pages and 301 redirect?

* On a side note, annoyingly, the CMS also displayed a duplicate page if the trailing slash was used. E.G. http://www.example.com/thing/green-widgets/pagename/

So I could use this opportunity to 301 redirect all pages to the trailing slash directory version of the URL (and stick an index.html age in the directory). However, this trailing slash url format was never linked to, so ideally I would prefer to keep the structure exactly as it is and redirect the 'directories' to the pages.

I know there are plenty of code examples as to removing file extensions, However, I should point out that these pages are only part of the site. There are hundreds of other static pages, with extensions, that I want to keep as they are.



 8:51 am on Jan 23, 2010 (gmt 0)

OK. This is what I have done. But I'm not sure that this was the best option, so be interested in any views.

I created a new MIME type text/html and called the extension .ttt

Then I added the following to .htaccess. I'm hoping that this should only affect (i.e. remove the file extension) of files with a .ttt extension?

RewriteCond %{REQUEST_filename} !-d
RewriteCond %{REQUEST_filename} !-f
rewriterule ^(([^/]+/)*[^./]+)/?$ /$1.ttt [L]

I'm still finding that the trailing slash version of the URL is loading the page, as does the .ttt version. But I can always 301 redirect that, which is a pain, but there's only a few dozen pages.

Does anyone see anything horrible in what I've done, or suggest any better options?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved