Forum Moderators: phranque
header(Location:) each other etc. I would like to not have to change all the existing file references. I would like attempts to load /xyz.php to be Redirect-ed to simply /xyz, which doesn't actually exist but then to use a RewriteRule to point it back to the /xyz.php. I can do the redirect or rewrite seperately but when I put them together it seems to cause an infinite loop. include() demands the extension. The only thing left to change, as far as I can think of, is header(Location:) calls. It would be kind of nice to have my PHP code consistently use the .php extension, but whatever. Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^.]+)$ $1.php [edited by: bill at 1:15 am (utc) on Apr 30, 2010]
[edit reason] turned off smilies [/edit]
Options +FollowSymlinks
RedirectMatch (.*)\.php $1
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.php$
RewriteRule ^([^.]+)$ $1.php
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine on
#
# Externally redirect [i]only[/i] direct client requests for /<anything>.php
# in any directory to /<anything> in that same directory
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.php\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.example.com/$1 [R=301,L]
#
# Internally rewrite requests for extensionless URL-paths to append ".php"
RewriteRule ^(([^/]+/)*[^./]+)$ /$1.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.php(.*)?\ HTTP/ RewriteRule ^([^.]+)$ $1.php Do I lose something doing it this way?
^(([^/]+/)*[^./]+)$ have over ^([^.]+)$ ?