2013-07-26 3 views
0

모든 PDF 파일 리디렉션 : 기본 도메인에난과 같은 URL을 리디렉션하기 위해 노력하고있어 주요 도메인

http://www.example.co.uk/pdfs/example-file.pdf

http://www.example.co.uk/files/example-file.pdf

http://www.example.co.uk/documents/example-file.pdf

http://www.example.co.uk/

# PDFs on old site, redirect them 
<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^/?pdf/(.*)$ http://www.example.co.uk/$1 [R=301,L] 
    RewriteRule ^/?files/(.*)$ http://www.example.co.uk/$1 [R=301,L] 
    RewriteRule ^/?documents/(.*)$ http://www.example.co.uk/$1 [R=301,L] 
</IfModule> 
# END PDFs on old site, redirect them 

여기서 내가 잘못 생각합니까?

답변

1

올바른 규칙은 다음과 같습니다

# PDFs on old site, redirect them 
<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^(/?pdfs/.*)$ http://www.example.co.uk/$1 [R=301,L] 
    RewriteRule ^(/?files/.*)$ http://www.example.co.uk/$1 [R=301,L] 
    RewriteRule ^(/?documents/.*)$ http://www.example.co.uk/$1 [R=301,L] 
</IfModule> 
# END PDFs on old site, redirect them 
관련 문제