我正在使用良好的結果下面的代碼來訪問我的php文件的alla沒有指定擴展名到/ it目錄。換句話說,我可以訪問「http://www.mydomain.com/it/about.php」只寫「http://www.mydomain.com/it/about」。使用 - 而不是_(下劃線)與.htaccess
Options -MultiViews
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://www.mydomain.com/it/$1.php [L]
同樣發生時,我嘗試進入http://www.mydomain.com/it/question_answers.php。 如何直接訪問*「http://www.mydomain.com/it/question_answers.php」*還寫作「http://www.mydomain.com/it/question-answers」? 我在前面寫了下面的浮動代碼,但它似乎不起作用。
Redirect 301 /question-answer http://www.mydomain.com/it/question_answer.php
,因爲如果我寫 「http://www.mydomain.com/it/question-answer」 瀏覽器嘗試打開該網頁: 「http://www.mydomain.com/it /question-answer.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php」
後的小摘要:
- 我的頁面* 「http://www.mydomain.com/it/question_answers.php」 *
- 與代碼的第一部分,我可以使用鏈接*「http://www.mydomain.com/it/question_answers」得到它*
- 我想訪問同一頁面也具有以下「http://www.mydomain.com/it/question-answers」
謝謝!
轉到serverfault.com –