404错误和.htaccess

时间:2012-05-04 14:17:25

标签: php .htaccess

我的脚本遇到错误404。

我想要隐藏页面标题。例如

http://example.com/final/admin/admin.php

我想将admin.php隐藏为

http://example.com/final/admin

以下是我的.htaccess始终返回 404页面未找到错误

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/final/.*$
RewriteRule ^(.*)$ /final/$1 [L]

这是我的index.php代码

<?php

/**
 * @author Mina Wilson
 * @copyright 2012
 * // EPCI Pharma Survey | Rights Reserved
 */
// Inialize session
session_start();
echo $_SESSION['message']; unset($_SESSION['message']);


ob_start();

session_destroy();

// Check, if user is already login, then jump to secured page

ob_start();
if (isset($_SESSION['name'])) {

header('Location: login_process.php');
}

ob_flush();
?>
-- html here 

谁能告诉我什么是错的?

1 个答案:

答案 0 :(得分:0)

像这样使用rewriterule。您可以单独使用rewriterule

RewriteRule final/(.*)$  index.php?page=$1 [NC,L]

但是这会将最后一个单词后面的任何页面重定向到index.php