我是新的重定向,我想知道它是如何工作的? 我有一些所谓的index.php文件,我想hadlle任何目录中的网站PHP .htacces和index.php重定向
index.php
<?php
if(empty($dir)){
include('includes/home.php');
}
if($dir=='profile'){
include('includes/profile.php');
}
elseif($dir=='settings'){
include('includes/settings.php');
}
else{
include('includes/404.php');
}
?>
的网址是:
test 1. www.example.com/ - will view the include home.
test 2. www.example.com/settings - will view the include settings.
test 3. www.example.com/errorsample - will view the include 404 page.
如何使.htaccess
,并使用该代码的index.php或任何想法如何工作和它的示例代码。
为什么它不起作用? .htacces #BEGIN WordPress的 RewriteEngine叙述在 重写规则^(。*)$ /index.php?x=$1 [L] #END WordPress的 的index.php
–Wordpress有这种类型的导航自己的'.htaccess'文件。它可能有其他规则来覆盖我的规则。 – Starx