Axel Stone
Axel Stone

Reputation: 1580

Header redirection doesn't work in some browsers

I'm using this command to redirect to another page:

header('Location: \dealer\skuska\layout.php');

In Chrome this works correctly, but in Firefox it is redirecting to:

http://212.5.221.26:85/dealer/skuska/actions/\dealer\skuska\index.php

Why is that happening, and how could I fix it?

Upvotes: 0

Views: 695

Answers (4)

Chintan Hingrajiya
Chintan Hingrajiya

Reputation: 810

you need to use full path like this

header('Location: http://example.com/dealer/skuska/layout.php');

also change \ to /

try this, this will work in all browsers.

Upvotes: 2

n-dru
n-dru

Reputation: 9440

Just use absolute url, then regardless where you call it, it will redirect you to the correct page. Chrome is less restrictive as to web standards, therefore allows for such inappropriate url. Also use forward slashes in the path.

Upvotes: 0

Cârnăciov
Cârnăciov

Reputation: 1144

If it's a one-use website, then use the absolute url. The whole url the landing page has.

If you need it to run on multiple domains, then use ../../../ till you reach the root folder, then add the full path again.

And use slashes, not backslashes

Upvotes: 0

hsols
hsols

Reputation: 71

Given that this redirect-script is located in "dealer/skuska/actions/", try using forward slashes, and add a two-dot directory to navigate one folder up, to redirect to "dealer/skuska/layout.php":

header('Location: ./../layout.php');
exit;

Upvotes: 0

Related Questions