Opinions wanted

Wack this in your .htaccess file and you can leave the file extensions off all together as every file is deemed to be php by default unless specified otherwise.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php


So you could access a page then by typing in ~
example.com/dir/page
rather than ~
example.com/page.htm

That way even if you changed your whole site from php to asp all you would have to do is change this 1 line
RewriteRule ^(.*)$ $1.asp

And every file gets parsed as a asp document instead. Now that's future proof, lol.

Jaz

Key:
Red ~ .htaccess
 
Are dude it is you know how an*l I get over extra characters imagine what I was like when I realized I can leave file extensions off in links, lol. :love:
 
Jazajay said:
Wack this in your .htaccess file and you can leave the file extensions off all together as every file is deemed to be php by default unless specified otherwise.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php


So you could access a page then by typing in ~
example.com/dir/page
rather than ~
example.com/page.htm

That way even if you changed your whole site from php to asp all you would have to do is change this 1 line
RewriteRule ^(.*)$ $1.asp

And every file gets parsed as a asp document instead. Now that's future proof, lol.

Jaz

Key:
Red ~ .htaccess
completely lost me with this, doesn't help that I'm bunged up with cold/flu so a simpletons explanation might be good for me, most of my files still end up as html anyways :)
 
For the time being I'd stick with the solution I gave you.

Jaz's is good but probably a bit more 'another-word-for-advanced-that-doesn't-sound-patronising' for what you need,
 
hey I just sit down and watch the show when you two start going at it with ideas/techniques, I'm nowhere near your levels :p
 
lol when we go at it, lol.
Basically what that does is tells the server to run all files as php unless you specifiy otherwise.

So

example.com/dir/some-page

is the same as
example.com/dir/some-page.php

If you want to change it to parse all files as html files unless the extension is on create a blank file, name it .htaccess, put this in it and upload it to your root directory.

So~
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.html

Then type in the browser if you are running a test server ~
localhost/dir/some-page

and it will display the same minus the file extension as ~
localhost/dir/some-page.html

If you upload it to your server and get a 500 error just delete the .htaccess file off it.

Jaz
 
Back
Top