Forum Moderators: phranque

Message Too Old, No Replies

Webpage Filenames

         

paranoia

3:22 pm on May 22, 2005 (gmt 0)

10+ Year Member



My question is a simple one, but one I can't find an answer to. Basically, on my site, I want simpler url's without file extensions. Like google, for example. Whether google just has actual files without extensions, or if they're using some wildcard-in-a-.htaccess-file trick, I'm not sure. So, a url would be something like

http://example.com/main?page=about.

Incidentally, they're all php files, but my hosting company apparently set it up to do something like "search for a folder with this name, keep going if not there, then search for a file with this name, return 404 if not found".

There's also a possibility that this is a default apache directive, but I am new to this so I'm not sure.

In conclusion, a) Will it hamper access of the site from certain users and b) Is there a special .htaccess trick I can use to stop those access problems? Or, should I scrap it all together and just make the url's four characters longer?

JKMitchell

8:37 pm on May 23, 2005 (gmt 0)

10+ Year Member



Not totally sure why you want to do this (to hide the fact that it's php?) but it can be done via .htaccess using a rewrite rule to convert to a .php extension for the server.

Alternatively you could, if it's a limited number of files put a line in the .htaccess file to force "main" to be interpreted as a php file.

paranoia

9:20 pm on May 23, 2005 (gmt 0)

10+ Year Member



Yeah, it's only two files, so I'll probably just end up creating a rewrite rule to make "main" be .php. As soon as I learn how .htaccess rewrite rules work...

Anyway, thanks.

JKMitchell

7:03 am on May 24, 2005 (gmt 0)

10+ Year Member



An example I use is :-

------------------

Options +Includes
AddHandler server-parsed .htm
AddHandler server-parsed .html

ErrorDocument 404 [domain.co.uk...]

<FilesMatch "^main$">
ForceType application/x-httpd-php
</FilesMatch>

-------------------

May not work for you but should point in the right direction.