Forum Moderators: phranque
I've been reading a lot about extensionless URLs and the different ways to accomplish them.
I want to use the following method with php:
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.+)/$ http://www.example.com/$1 [R=301,L]
Since I'm not much of an expert I'd like to ask if there's anything wrong with my approach. I have read jdMorgan's post [webmasterworld.com] that says:
The right way to do this is name the files as .php, and then rewrite the URLs that have no extension to those filenames using mod_rewrite.
I figured that my way would be slightly faster than a method including mod_rewrite. Am I missing anything here? Could I run into some unforseen trouble with this method?
Thanks!
-Harry
Apache can run PHP files without extension wherever scripts/CGI can run as long as their first line is a declaration to the executable that loads them:
In Windows: #!C:/apps/php/php-4.3.11-Win32/php.exe -q
In *NIX: #!/usr/local/bin/php5/bin/php