問題描述
我有一個問題,我正在為特定應用開發網絡服務.上周我將備份從 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:
- 左鍵單擊 WAMP 圖標
- 阿帕奇
- Apache 模塊
- 左鍵單擊 rewrite_module.
這篇關于使用 .htaccess 重寫 URL 以隱藏 PHP 擴展名的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!