첫 번째 URL을 두 번째 URL로 리디렉션 할 수있는 방법이 있습니까?중복 사본 제거 (html 확장자와 비 html)
http://www.example.com/podcast/episode
같은 페이지의 중복 된 복사본으로 표시하지 않도록, URL의 HTML이 아닌 버전으로 리디렉션 할 .html 중에서 확장자를 강제로 어떤 방법이 있나요
http://www.example.com/podcast/episode.html. 순간
내 htaccess로 코드는 다음과 같습니다
RewriteEngine On
RewriteBase/
#removing trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301,L]
#non www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#shtml
AddType text/html .html
AddHandler server-parsed .html
#html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]
#index redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://example.com/ [R=301,L]
이 가능합니까?
는
문서 루트 또는 podcast 디렉토리에 .htaccess 파일이 있습니까? 이것은 정말로 중요한 세부 사항입니다. –
@JonLin .htaccess가 문서 루트에 있습니다. – Jeremy
무엇이 잘못되었는지 알지 못합니다. 규칙과 Tim Stoop의 규칙을 테스트 Apache 서버에 붙여 넣기 만하면됩니다. –