1

ホスティング会社のポリシーにより、CakePHP でプリティ URL を使用しています (Apache mod の書き換えなし)。私のホームページは次のとおりです。

http://stthomasedu.org/index.php/home

トラフィックをリダイレクトするにはどうすればよいですか

「http://stthomasedu.org/」から「http://stthomasedu.org/index.php/home」へ?

index.php を編集しようとしました

header("Location:http://stthomasedu.org/index.php/home");

しかし、URL「http://stthomasedu.org/index.php/home」を手動で入力する必要があるたびに、うまくいきません

何か案は?

解決済み : C パネルで、すべてのトラフィックを任意の場所 (http://stthomasedu.org) にリダイレクトするオプションがあります (現在はhttp://stthomasedu.org/index.php/homeに設定しています)

4

2 に答える 2

1

Apache を使用しているため、次の行を.xml に追加でき.htaccessます。

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^$
RewriteCond %{HTTP_HOST} ^stthomasedu.org$
RewriteRule ^$ http://stthomasedu.org/index.php/home [L,R=301]
于 2012-05-09T12:41:47.823 に答える
0

header() 呼び出しの後に終了することを覚えていましたか?

header('Location: /index.php/home');
exit;
于 2012-05-09T12:21:06.757 に答える