簡體   English   中英

這個mod重寫在htaccess文件中有什么作用?

[英]What does this mod rewrite do in htaccess file?

我有一些ht代碼,我只想

知道這段代碼到底能做什么?

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !public
RewriteCond %{REQUEST_URI} !robots.txt
RewriteRule . /index.php [L]
</IfModule>
  1. 第一條規則將www從您的網址中刪除
  2. 第二條規則跳過對/index.php重寫
  3. 第三條規則將/public/robots.txt以外的所有URI重寫為/index.php

參考文獻:

1. Apache mod_rewrite簡介

2. Apache mod_rewrite技術細節

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM