The requested URL /generate/5r4reia5b7 was not found on this server

  apache, php

I just got a project about a wishcard system but I’m lost.
I don’t know anything about server.

I got an .htaccess file like this

Options -Indexes
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^generate/(.*)$ generate.php?hash=$1 [L]
RewriteRule ^send/(.*)$ send.php?hash=$1 [L]
RewriteRule ^view/(.*)$ view.php?hash=$1 [L]

That’s work on MAMP (on my local server) but not on a dev server

On dev server I got :

The requested URL /generate/5r4reia5b7 was not found on this server

When the user click on a button to generate a wishcard, the url is : http://www.example.com/generate/5r4reia5b7

function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}

<button id="go">Create my card</button>

$("#go").click(function( event ) {
    saveAction('btCreateCard');
    window.location = '/generate/<?php echo generateRandomString() ?>';
});

Can I have some help please? What’s wrong between the php code/.htaccess? Is it because of the server configuration?

Source: Ask PHP

LEAVE A COMMENT