Web サイトで MVC フレームワークを使用しています。Web ページの URL ファイル拡張子が表示されません。次のようなファイル拡張子を指定する必要があります。
www.legacy.com/women/tops.php
しかし、その表示のみ
www.legacy.com/women/tops/
SEOの目的で、拡張子付きのURLを変更したい。しかし、フォルダやファイル名を変更することはできません。
もう1つ疑問があります.私のウェブページは表示されています
www.legacy.com/women/tops/
このように、これを www.legacy.com/women_tops.php/ に変更したいのですが、可能ですか?
ありがとうございました
URL をコントローラーに関連付けるために使用するコードは次のとおりです。
$arrCommands = array (
'home' => "contents",
'members' => "",
);
if ( $arrCommands[$command1] == "*" )
{
$includeFile = CONTROLLER_PATH . "/" . $command1 . "/" . $command2 . ".php";
if ( !file_exists($includeFile) )
$includeFile = CONTROLLER_PATH . "/" . $command1 . "/default.php";
}
elseif ( !array_key_exists($command1, $arrCommands) )
{
$includeFile = CONTROLLER_PATH . "/contents/" . $command1 . ".php";
if ( !file_exists($includeFile))
Header( "Location: http://metroplots.ragedev/404_error/" );
}
else
{
$includeFile = CONTROLLER_PATH . "/". $arrCommands[$command1] . "/" . $command1 . ".php";
if ( !file_exists($includeFile) )
$includeFile = CONTROLLER_PATH . "/contents/home.php";
}
include_once($includeFile);