作者haidai (haidai)
看板Web_Design
標題[問題] htaccess如何設定轉址例外?
時間Fri Apr 21 09:18:37 2017
我把網站的所有404通通轉去404.html
但是現在發生了連sitemap都被轉走
現在Google抓不到我的sitemap
想問如果設定404一律轉址的話
如何設定例外?
--
◢◣ ◢
▄◣ ◎每月
29日為
天使節 \(≧▽≦)/
◤
▌ ◢
▄◤◥ ◎當天呼叫平時就保持聯絡的
小天使
▌ ◢
▄◤ ◎點歌給小天使並發表於
AngelPray板
▆████▆ ◎小天使就會下
P幣雨喔 ( ̄▽ ̄)>
◢"◣
≧ ≦ ︴
\|/ \|/ \|/ \|/ \|/ \|/ \|/ ◢◣
◢◣
▄ ▄ ︴
◢=█◣◢`█◣◢=█◣◢"█◣◢`█◣◢"█◣◢"█◣ ︴
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.33.143
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Web_Design/M.1492737525.A.B0D.html
1F:→ imhaha: sitemap也404?04/21 18:46
2F:→ haidai: 對啊,感覺不是html或是圖檔就會被轉走04/21 19:03
3F:→ haidai: 之前測試OK的sitemap更新之後也404了 04/21 19:03
4F:→ Hevak: 你自己怎麼寫也沒貼是要怎麼幫你debug....這不是靠感覺的 04/23 12:01
抱歉,我以為大家基本上都用同一段code
<files .htaccess>
order allow,deny
deny from all
</files>
# use PHP4 as default
#AddHandler application/x-httpd-php4 .php
<IfModule mod_rewrite.c>
RewriteEngine On
ErrorDocument 404 /404.html
</IfModule>
我是這樣寫
5F:→ AndCycle: deny from all ... 04/25 19:13
6F:→ AndCycle: 不對, 你這個要看 apache log 啊, 你要看他為什麼拒絕 04/25 19:14
7F:→ AndCycle: 而且你有 ErrorDocument , 不需要用 rewrite 04/25 19:16
8F:→ AndCycle: RewriteEngine 我去查參數只有 on/off, 你這哪抄來的... 04/25 19:22
我忘記分行
If前面是本來就有的我沒去更改
後面 <IfModule 開始是這邊找的
http://www.vixual.net/blog/archives/247
※ 編輯: haidai (125.230.74.154), 04/25/2017 20:38:54