Thank you for your help.
The site you are currently managing is
For example http://example.com/files/content
In response to the request, you can use .htaccess.
RewriteRule^files/([0-9A-Za-z_)]+)$1.php[QSA,L]
in the form
I try to display content.php.
However, with the current configuration,
http://example.com/content.php
The same file appears when accessed in .
If you look at the apache access log, sometimes you see a log of requests ending directly in .php, so if possible, I would like to try not to open anything other than the specified php file.
For example, as a file that permits a.php and b.php,
http://example.com/a.php
http://example.com/b.php
I can open it even if I request it in
I would like to display error.html for other requests containing ".php" such as http://example.com/content.php
.
RewriteRule^files/([0-9A-Za-z_)]+)$1.php[QSA,L]
RewriteCond%{REQUEST_URI}!a.php$
RewriteCond%{REQUEST_URI}!b.php$
RewriteRule^([0-9A-Za-z_)]+).php$error.html[L]
Now that I've done this,
You can open it with a.php, b.php, but
Important
http://example.com/files/content
However, error.html is now displayed.
Please advise me on how to write it.
Thank you for your cooperation.
The L|last flag stops there if you set it in httpd.conf, but if you set it in .htaccess, the rewritten URL appears to be parsed from the first rule again.
For Apache httpd 2.4, [END] is available instead of [L].
For Apache httpd 2.2 and earlier, the only way to do this is to set it to httpd.conf.
© 2024 OneMinuteCode. All rights reserved.