automatic read php url website

Solutions on MaxInterview for automatic read php url website by the best coders in the world

showing results for - "automatic read php url website"
Javier
03 Jan 2018
1So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.
2
3.htaccess:
4
5RewriteEngine on
6
7# Rewrite /foo/bar to /foo/bar.php
8RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
9
10# Return 404 if original request is /foo/bar.php
11RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
12RewriteRule .* - [L,R=404]
13
14# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this:
15# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC]