简体   繁体   中英

404 error and .htaccess

I am facing error 404 with my script.

I want to hide the page title. For example

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

I want to hide admin.php to be

http://example.com/final/admin

Here is my .htaccess that always returns a 404 page not found error

RewriteEngine On

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

Here is my index.php code

<?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 

Can anyone tell me what's wrong?

Use rewriterule like this. You can use rewriterule alone

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

But this redirects any page after final word to index.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM