工作,我用Redirect
在.htaccess
文件,如下所示:的Apache的.htaccess重定向301不與PDF鏈接
## Redirects
Redirect 301 /d1_tm1_location.html /d1_tm1_location.php
Redirect 301 /d1_tm2_history.html /d1_tm2_history.php
Redirect 301 /d1_tm3_articles.html /d1_tm3_articles.php
Redirect 301 /d1_tm4_culture.html /d1_tm4_culture.php
Redirect 301 /d1_tm5_economy.html /d1_tm5_economy.php
Redirect 301 /d1_tm6_symbols.html /d1_tm6_symbols.php
Redirect 301 /d1_tm7_gallery.html /d1_tm6_symbols.php
Redirect 301 /d1_tm_civil.html /d1_tm6_symbols.php
Redirect 301 /d1_tm_education.html /d1_tm6_symbols.php
Redirect 301 /d1_tm_sport.html /d1_tm_sport.php
Redirect 301 /d1_tm_villages.html /d1_tm_villages.php
Redirect 301 /d2_ref1_phonebook.html /d2_ref1_phonebook.php
Redirect 301 /d2_ref_transport.html /d2_ref_transport.php
Redirect 301 /d3_ic1_services.html /d3_ic1_services.php
Redirect 301 /d3_ic_enterpreneur.html /d3_ic_enterpreneur.php
Redirect 301 /d3_ic_eservices.html /d3_ic_eservices.php
Redirect 301 /d3_ic_social.html /d3_ic_social.php
Redirect 301 /d3_ic_taxes.html /d3_ic_taxes.php
Redirect 301 /d4_adm1_structure.html /d4_adm1_structure.php
Redirect 301 /d4_adm2_contacts.html /d4_adm2_contacts.php
Redirect 301 /d4_adm5_strategy.html /d4_adm5_strategy.php
Redirect 301 /d4_adm6_budget.html /d4_adm6_budget.php
Redirect 301 /d4_adm7_registers.html /d4_adm7_registers.php
Redirect 301 /d4_adm_awards.html /d4_adm_awards.php
Redirect 301 /d5_mc1_composition.html /d5_mc1_composition.html
Redirect 301 /d5_mc2_regulations.html /d5_mc2_regulations.php
Redirect 301 /d6_prj1_current.html /d6_prj1_current.php
# >>> FAILS TO MATCH
Redirect 301 /adm_strategy/Strategia%20za%20zakrila%20na%20deteto%202007-2009.pdf /adm_strategy/Strategia%20za%20zakrila%20na%20deteto.pdf
RedirectMatch 301 /buyerprofile/(.*)\.html$ /buyerprofile/$1.php
所有重定向正常工作,除了PDF文件規則。舊文件是:
http://www.lyaskovets.net/adm_strategy/Strategia%20za%20zakrila%20na%20deteto%202007-2009.pdf
和新的一個是:
http://www.lyaskovets.net/adm_strategy/Strategia%20za%20zakrila%20na%20deteto.pdf
AllowOverride All
放在httpd.conf
文件。
我不知道該問題與該文件類型是PDF還是該文件名包含空格有關,但該規則不起作用。 有人可以幫助我的想法在哪裏搜索問題...
的情況是在兩個阿帕奇服務器一樣的:
的Linux:的Apache/2.2.3(CentOS的),在WWW服務器.lyaskovets.net端口80
的Windows:的Apache/2.2.19(Win64中)PHP/5.3.5服務器在www1.lyaskovets.net端口80