centos 開啟apache偽靜態

來源:互聯網
上載者:User

標籤:apache

1.開啟rewrite模組

vim httpd.conf#[plain] view plain copyLoadModule rewrite_module modules/mod_rewrite.so


2.開啟AllowOverride

[plain] view plain copy#  # AllowOverride controls what directives may be placed in .htaccess files.  # It can be "All", "None", or any combination of the keywords:  #   Options FileInfo AuthConfig Limit  #  AllowOverride None  修改 AllowOverride None 為  AllowOverride All

關於AllowOverride 說明:

AllowOverride參數就是指明Apache伺服器是否去找.htaccess檔案作為設定檔,如果設定為none,那麼伺服器將忽略.htacess檔案,如果設定為All,那麼所有在.htaccess檔案裡有的指令都將被重寫。對於AllowOverride,還可以對它指定如下一些能被重寫的指令類型. 通常利用Apache的rewrite模組對 URL 進行重寫的時候, rewrite規則會寫在 .htaccess 檔案裡。但要使 apache 能夠正常的讀取.htaccess 檔案的內容,就必須對.htaccess 所在目錄進行配置。從安全性考慮,根目錄的AllowOverride屬性一般都配置成不允許任何Override ,即 代碼如下: <Directory /> AllowOverride None </Directory>在 AllowOverride 設定為 None 時, .htaccess 檔案將被完全忽略。當此指令設定為 All 時,所有具有 ".htaccess" 範圍的指令都允許出現在 .htaccess 檔案中。 而對於 URL rewrite 來說,至少需要把目錄設定為 代碼如下: < Directory /myblogroot/> AllowOverride FileInfo < /Directory>


3.允許apache支援.htaccess

[plain] view plain copyOptions FollowSymLinks   AllowOverride None  修改為[plain] view plain copyOptions FollowSymLinks  AllowOverride All


4.重啟進程

systemctl restart httpd.service


本文出自 “深呼吸再出擊” 部落格,請務必保留此出處http://ckl893.blog.51cto.com/8827818/1928134

centos 開啟apache偽靜態

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.