It will be a stupid question, I think, but I don’t see what is happening here. I want to map a specific set of URIs through a regular expression in a .htaccess file.
I want the following
- All files that do not contain.
- all files ending with .htm / .html
- all files ending with .php
So:
^[^.]+$
works to match all dotless files in a URI.
\.html?$
matches all .html / .htm files
(^[^.]+$)|(\.html?$)
seems to work by combining how
(^[^.]+$)|(\.html?$)|(\.php$)
cannot combine things with matching files ending in php-case. test.jpg, for example, matches now, while it shouldn't.
I have to miss something obvious. What is it? Thank.
Update: here is the whole context that I used:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (^[^.]+$)|(\.html?$)|(\.php$) bootstrap.php [L,QSA]
bootstrap.php contains:
echo "testing bootstrap";
Request non-existent .jpg
http:
gives me this result:
testing bootstrap
...
2:
, :
RewriteRule \.php$ bootstrap.php [L,QSA]
, . test.jpg. .htaccess, ... , .htaccess, , :
AddType application/x-httpd-php .html
AddType application/x-httpd-php .xml
DirectoryIndex index.php
ErrorDocument 404 /errors/404.php
: ( 8 ...)
, .
@mario, .
. :
rewrite.log:
strip per-dir prefix: D:/Web_Root/test.jpg -> test.jpg
applying pattern '\.php$' to uri 'test.jpg'
pass through D:/Web_Root/test.jpg
strip per-dir prefix: D:/Web_Root/errors/404.php -> errors/404.php
applying pattern '\.php$' to uri 'errors/404.php'
RewriteCond: input='D:/Web_Root/errors/404.php' pattern='!-d' => matched
rewrite 'errors/404.php' -> 'bootstrap.php'
...
, , 404 *.php, *.jpg . Ah Bats, ...
, :
RewriteRule ([^4]?[^0]?[^4]\.php) bootstrap.php [L,QSA]
, :
RewriteRule (^[^.]+$)|(\.html?$)|([^4]?[^0]?[^4]\.php) bootstrap.php [L,QSA]
: .