muttley91
muttley91

Reputation: 12674

PHP Header Location redirect to root of current folder

I'm redirect from one page to the index.php file of the current directory. I'm doing so while setting a GET parameter, and I'd like to do something like the following.

header("Location: ?v=30");

This would be on page2.php, redirecting to index.php?v=30. I know I can fix it by using:

header("Location: index.php?v=30");

but I'd like to keep the URL simpler, and I was hoping there was a way to do it the former way.

Upvotes: 2

Views: 12749

Answers (1)

PlantTheIdea
PlantTheIdea

Reputation: 16369

Try this:

header("Location: ./?v=30");

Upvotes: 13

Related Questions