我有一个问题,我正在为特定应用开发网络服务.上周我将备份从 server1 转移到 server2,因为那一刻我的 .htaccess 将不再工作.
I've a question, I'm developing a webservice for a specific app. Last week I transferred my back-up from server1 to server2, since that moment my .htaccess won't work anymore.
我的网络服务的网址是:http://apps.holtesdesign.nl/inholland/apiv0/
The url for my webservice is: http://apps.holtesdesign.nl/inholland/apiv0/
这个 url 工作正常,加载错误报告模块:http://apps.holtesdesign.nl/inholland/apiv0/bugreport.php
This url works fine, to load the bugreport module: http://apps.holtesdesign.nl/inholland/apiv0/bugreport.php
但网址应该是:http://apps.holtesdesign.nl/inholland/apiv0/bugreport
当您打开最后一个 url 时,您会看到它会导致内部服务器错误.你知道这怎么可能吗?
When you'll open the last url, you'll see that it will result in an internal server error. Do you know how it's possible?
我的 .htaccess 看起来像:
My .htaccess looks like:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
服务器在 CentOS 上运行,我已经检查过 mod_rewrite 是否正在运行...
The server is running on CentOS, and I've already checked if mod_rewrite is functioning...
我希望你们能帮助我!
干杯,
杰尔默
这将解决它:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1.php
<小时>
如果它不起作用,请更正 Wamp 服务器的设置:
If it doesn't work correct the settings of your Wamp Server:
这篇关于使用 .htaccess 重写 URL 以隐藏 PHP 扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!