문제

index.html | php | php5에 대한 모든 요청을 리디렉션하고 싶습니다. http://www.domain.co.uk/ Mod_rewrite를 사용하여 PHP Verbatim을 사용한 검색 엔진 최적화에 관한 책에서 코드를 복사 한 다음 PHP5 옵션을 추가했지만 작동하지 않습니다. 이것은 내 전체 .htaccess 파일입니다.

RewriteEngine On

#translate any .html ending into .php5
RewriteRule ^(.*)\.html$ /$1\.php5

RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php5|php|html)\HTTP
RewriteRule ^(.*)index\.(php5|php|html)$ /$1 [R=301,L]

#change / for ?
RewriteRule ^(.*)\.html/(.*)$ /$1\.html?$2

#strip .html from search res page
RewriteRule ^(.*)search/(.*)$ /$1search_results\.html/search=$2

#translate product details link from search res page
RewriteRule ^products/(.*)/(.*)/(.*)$ /product_details.php5?category=$1&title=$2&id=$3 [L]

#Translate products/psorisis/chamomile-skin-cream-P[x] to productview.php5?id=1
RewriteRule ^products/.*-P([0-9]+) /productview.php5?id=$1 [L]

나는 그것에 무엇이 잘못되었는지 모르겠다. 누구든지 생각이 있습니까?

도움이 되었습니까?

해결책

나는 당신의 rerwritecond가 끝나기 때문이라고 생각합니다 \HTTP.

변경 :

RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php5|php|html)
RewriteRule ^(.*)index\.(php5|php|html)$ /$1 [R=301,L]

the_request의 http와 일치하려면 거기에 공간을 두십시오.

RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php5|php|html)\ HTTP
RewriteRule ^(.*)index\.(php5|php|html)$ /$1 [R=301,L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top