xPrcek
(xPrcek)
May 31, 2016, 2:58pm
1
Hi guys,
first let me say I like caddy for its simple configuration and LE integration. Second, please help me set caddy to execute PHP-FPM for URLs without extension (.php), for example URL Custom Application Development Software for Business - Salesforce.com will execute www.site.com/phpinfo.php , but hide .php extension in the reply URL. For apache I have this .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Thank you in advance.
xP
hendry
(Kai Hendry)
May 31, 2016, 3:04pm
2
Usual practice is to to have phpinfo/index.php
instead there xP!
xPrcek
(xPrcek)
May 31, 2016, 3:13pm
3
Another usual practise is to hide file extensions, so please lets solve the configuration, not practice. There are several .php files in the current directory and rename all files to index.php and move them to their own directories is not cool.
matt
(Matt Holt)
May 31, 2016, 3:15pm
4
Have you tried the ext
directive already?
2 Likes
abiosoft
(Abiola Ibrahim)
May 31, 2016, 7:12pm
5
This should be enough
ext .php
If you still want to use rewrite
, the direct conversion of that rewrite rule will not server any file other than .php
rewrite {
r (.*)
to {path}/ {path}.php {1}.php
}
But this is better as it serves other files if they exist.
rewrite {
to {path}/ {path} {path}.php
}
To conclude, in this case I will rather follow Caddy’s philosophy and keep it simple by using ext .php
.
2 Likes
xPrcek
(xPrcek)
May 31, 2016, 7:19pm
6
ext .php
works for me as expected. Thank you guys.
xP
2 Likes
system
(system)
Closed
August 29, 2016, 7:19pm
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.