Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7591661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:42:24+00:00 2026-05-30T20:42:24+00:00

I am trying to redirect users to a different page using the Header function

  • 0

I am trying to redirect users to a different page using the Header function in PHP like so but it doesn’t work:

Header("Location: " . VIEW_PATH. "/somePage.html");

VIEW_PATH is defined in my config.php like this:
define(‘VIEW_PATH’, DIR.”\View”);

The Header function is currently in my Auth Class in my Controller Folder and I am trying to redirect users to a page in my View folder.

This works but I want to make use of VIEW_PATH:
Header(“Location: ../View/somePage.html”);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:42:25+00:00Added an answer on May 30, 2026 at 8:42 pm

    As i can see, your VIEW_PATH constant contains physical path on server. But you should use url path to file in your header call.

    Look at this example.

    define('VIEW_PATH', 'C:\xampp\htdocs\Store\View');
    define('VIEW_URL',  'http://www.example.com/Store/View');
    // or define('VIEW_URL', '/Store/View');
    

    P.S.
    Also you should use / in your url, not \

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'd like to redirect mobile users to a different page. But instead of
i am trying to redirect users without javascript enabled to our help page (help.php),
I am trying to redirect the user to a different page after 1 second
Trying to redirect users to their associated 'home' page after successful login w/out nil'ing
I'm trying to create a Email to friend page using php. The objective of
I am trying to redirect my users to the Permission Request page of Facebook,
I am trying to redirect the user to a different page upon clicking on
I'm trying to redirect to a page that uses basic authentication, with no success
I'm trying to redirect all requests to my domain to another domain using mod_rewrite
I'm trying to redirect/forward a Pylons request. The problem with using redirect_to is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.