ウェブのルートディレクトリ(Apache では public_html)に次のファイルとディレクトリを置く。
すべてのアクセスにおいてルートディレクトリの index.php を読みこむようにする。この設定は htaccess で行う。
index.php では
などを行う。サインインなどの複雑なページが多い場合、四番目のヘッダーとフッターの読みこみは行わないほうがいい。
すべてのページで上の index.php を読みこませるためには htaccess でリダイレクトを行う。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
続いて相対パスをディレクトリにアクセスさせる。
RewriteEngine On
RewriteBase /
RewriteRule ^(account|sign|user)(.*)$ index.php [L]
これで /account/ という相対パスにアクセスできるようになった。/account/ にアクセスしたときの表示は /account/index.php に書く。