Home http 500 error when access a post
Reply: 0

http 500 error when access a post

jazuly aja
1#
jazuly aja Published in 2018-01-09 07:34:24Z

why i get http 500 error when someone access wrong url?

but this error not showing in all post. in some post error message that i create working and in some post will showing http 500 error when access with wrong id of the post.

for example the right url is http://www.myweb.org/wmovies/901131742/insidious--the-last-key

when i access http://www.myweb.org/wmoviesssss/901131742/insidious--the-last-key

my page will showing not found error, since wmoviesssss is not in my database.

then when i try to access http://www.myweb.org/wmovies/901131742222222222222/insidious--the-last-key my web get http 500 error.

my code to create error message

 $idpost = htmlentities($_GET['idp']);
$cat = htmlentities($_GET['cat']);
        $decodestrtolower = $cat;
            $replacementsstrtolower = [
            'dorama' => "Dorama",
            'kdrama' => "KDrama",
            'wseries' => "WSeries",
            'jmovies' => "JMovies",
            'wmovies' => "WMovies",
        ];
    $query = $db->prepare ("SELECT * FROM master_post WHERE category = :category AND id_master_post = :idpost");
        $query->bindParam(":idpost", $idpost);
        $query->bindParam(":category", $newdecodestrtolower);
        $query->execute();

        // 404 Not Found Condition Start
        $count = $query->rowCount();
        if($count == 0) {
            include 'core/header.php';
            echo "<div class='maincontainer'><h1>404 Not Found.</h1>
            <h3>The Path You Requested Does Not Exist on This Server.
            Perhaps Searching Can Help.</h3></div>";
            exit();
        }

my .htaccess code

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
        RewriteRule ^([A-Za-z]+)/([0-9]+)/([\w-]+)/?$    view.php?cat=$1&idp=$2&post=$3&%{QUERY_STRING}   [NC,L]
        RewriteRule ^category/([\w-]+)/?$ category.php?cat=$1&%{QUERY_STRING}   [NC,L]

    # To externally redirect /dir/abc.php to /dir/abc
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.+?)\.php[\s?] [NC]
    RewriteRule ^ /%1 [R=301,L,NE]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
        RewriteRule ^(.+?)/?$ $1.php [QSA,NC,L]
</IfModule>

ErrorDocument 404 http://www.piratefiles.org/404.php
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322805 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO