advanced-php-mvc-blog icon indicating copy to clipboard operation
advanced-php-mvc-blog copied to clipboard

Nice project, but not work

Open ghost opened this issue 3 years ago • 8 comments

Hi and thanks for your project, but unfortunately it doesn't seem to work. This is the problem it gives Cattura and the links do not work and always refer to the home by adding a double slash.

For example, if I click on login it results: www.mvc3.local//login with a double slash form www.mvc3.local and login. See the screenshot.

I have tested with many php version: from 5.6.40 to 8.0.6

ghost avatar Jun 24 '21 13:06 ghost

Hello adrix71,

It doesn't seem to me the error message from your screenshot.

I would recommend using xampp instead of wamp.

Put your current code on a gist or a repository to check it.

Also install latest version of it.

hassanzohdy avatar Jun 24 '21 13:06 hassanzohdy

Hello and thanks for the reply.

To tell the truth I have not made any changes to the code, but I only installed the version present in your repository on github; I suppose it is the most up-to-date version.

As for xampp unfortunately it is not possible for me to install it and I have to use wampp for many other reasons.

What could be the cause of the fact that only the homepage works?

ghost avatar Jun 24 '21 13:06 ghost

What happens when you manually change the url to the login route?

hassanzohdy avatar Jun 24 '21 13:06 hassanzohdy

I had thought about it too and it was the first attempt, but nothing changes even by manually setting the url

ghost avatar Jun 24 '21 13:06 ghost

I just cloned the repository and imported the database associated with it and it works fine with me.

hassanzohdy avatar Jun 24 '21 14:06 hassanzohdy

I did the same thing by cloning the repository and importing the database, but for the second time it gives me the same problem.

I don't really understand what it can come from. Do you have to recommend some version of PHP and Apache in particular? Have you ever seen those.

ghost avatar Jun 24 '21 14:06 ghost

Try using version 7.4.

Also i can not see any error message in that trace list.

What does the home page you've look like?

hassanzohdy avatar Jun 24 '21 14:06 hassanzohdy

try this

/**
 * Prepare url
 *
 * @return void
 */
public function prepareUrl()
{
    $script = dirname($this->server('SCRIPT_NAME'));
    $requestUri = $this->server('REQUEST_URI');

    if (strpos($requestUri, '?')!==false) {
        list($requestUri,$queryString) = explode('?',$requestUri);
    }
    $this->url = rtrim(preg_replace('#^'.$script.'#', '' , $requestUri), '/');
    if (! $this->url){
        $this->url = '/';
    }

    $this->baseUrl=$this->server('REQUEST_SCHEME') . '://'.$this->server('HTTP_HOST') . $script .'/';


}

bjenmonk avatar Aug 07 '21 23:08 bjenmonk