그래서 htaccess로의 RewriteRules에 대해 배우려고 노력하고있어 다음과 같은 문제에 직면하고있다 index.php를 대신 문자열 전달합니다htaccess로 RewriteRule의는
"/ 홈" "의 index.php 페이지 = 집에?"열어야합니다
그리고 나는 "index.php"안에 PHP $ _GET [ 'page']가 있지만 매번 "home"대신 "index.php"를 전달합니다. 여기
는 파일입니다htaccess로
RewriteEngine On
RewriteRule ^/?(.+)/?$ index.php?page=$1 [L]
의 index.php의 PHP 부분
<?php
if(isset($_GET['page'])) {
$path = $_GET['page'] . ".php";
if (file_exists($path)) {
include($path);
}
else {
echo "File not found: " . $path;
}
}
else {
include("home.php");
}
?>
출력은 항상 :
File not found: index.php.php
나는이 문제에 직면 둘 다 : 웹 서버와 pache.
제안 사항? 필요한 경우 추가 정보로 내 질문을 업데이트하겠습니다.
이'RewriteRule의^시도를 | $ /index.php?page=$1를 [(/) (*.) QSA, L]'(우리 서버에서는 이것을 테스트하지 못했지만 우리가 가지고있는 것과 매우 비슷하다.) – IncredibleHat
당신이 알고있는 페이지 집합을 가지고 있다면'RewriteRule^(home | about | catalog) (/ |) $ /$1.php [QSA, L]' – IncredibleHat