简体   繁体   English

是否可以在没有 htaccess 的 URL 中隐藏 .php 扩展名或将 .php 替换为 .html?

[英]Is it possible to hide a .php extension or replace .php with .html in a URL without htaccess?

I have tried to find the answer, but I failed.我试图找到答案,但我失败了。 Other questions are with htaccess .其他问题htaccess 有关

I found this question similar of my question, but I did not get my answer.我发现这个问题与我的问题相似,但我没有得到我的答案。

I need it without .htaccess , because I do not have permission of URL rewriting in my client's server.我不需要.htaccess就需要它,因为我没有在客户端服务器中重写 URL 的权限。

How can I achieve this?我怎样才能做到这一点?

If you don't have access to your .htaccess or httpd.conf file the you could set up a proxy (like nginx) in front of the web server, point the DNS record to this proxy and have the proxy rewrite the requests from .html to .php to pass on to your apache server.如果您无权访问您的.htaccesshttpd.conf文件,您可以在 Web 服务器前设置一个代理(如 nginx),将 DNS 记录指向此代理并让代理重写来自.htaccess的请求。 html 到 .php 以传递到您的 apache 服务器。

However, if you don't have access to .htaccess or httpd.conf files, you probably don't control the DNS records...但是,如果您无权访问 .htaccess 或 httpd.conf 文件,则您可能无法控制 DNS 记录...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM