問題描述
如果我理解正確,我需要在 httpd.config
中放一些東西來啟用 mod_rewrite.如果這是真的,我需要在 httpd.conf
或 apache.conf
中放入什么?請針對操作系統(tǒng).
If I understand correctly, I need to put something in httpd.config
to enable mod_rewrite. If this is true, what do I need to put in httpd.conf
or apache.conf
? Please be OS specific.
推薦答案
不,mod_rewrite
是一個 Apache 模塊,與 PHP 無關(guān).
Nope, mod_rewrite
is an Apache module and has nothing to do with PHP.
要激活模塊,httpd.conf
中的以下行需要激活:
To activate the module, the following line in httpd.conf
needs to be active:
LoadModule rewrite_module modules/mod_rewrite.so
要查看它是否已經(jīng)處于活動狀態(tài),請嘗試將 .htaccess
文件放入包含該行的 Web 目錄
to see whether it is already active, try putting a .htaccess
file into a web directory containing the line
RewriteEngine on
如果這在不引發(fā) 500 內(nèi)部服務(wù)器錯誤的情況下有效,并且 .htaccess
文件被解析,則 URL 重寫有效.
if this works without throwing a 500 internal server error, and the .htaccess
file gets parsed, URL rewriting works.
這篇關(guān)于如何在任何操作系統(tǒng)上啟用 mod_rewrite?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!