0

$_get 関数を使用して文字列を使用してコンテンツ ページをプルする Web サイトに対して、htaccess URL の書き換え (R=302) を実行しようとしています。たとえば、次のように変更しようとしています。

http://www.site.com/index.php?page=about

これに:

http://www.site.com/about/

ただし、2 番目の URL のクエリを使用すると、index.php ファイル内のヘッダーとフッターのデータをリダイレクトするように設定することができましたが、CSS または $_get 情報を取得しませんコンテンツ。htaccess エントリと $_get 情報は次のとおりです。

RewriteEngine On
RewriteBase /
RewriteRule ^(.*?)/$ /index.php?page=$1 [NC,QSA,L]
RewriteRule ^(.*?)/$ $1.html [NC,L,QSA,R=302]


<?php
$folder = '';
$ext = 'html';
if (!$_GET['page'] || strpos($_GET['page'], '/') === true)
$path = 'home.' . $ext;
else $path = $_GET['page'] . '.' . $ext;
if (!file_exists($path)) {
 $messages = array(
      '404: Page does not exist; Please check the URL you entered.',
      '404: Error 404, please check the URL of the page.'
 );
 print $messages[ rand(0, (count($messages) - 1)) ];
}
elseif (!@include($path)) print '300: couldn\'t get the page';
?>

どんな助けでも大歓迎です。私はphpコードを変更しようとして失敗しましたが、それが問題だと思っています。

4

1 に答える 1