Link to home
Start Free TrialLog in
Avatar of Ivan Golubar
Ivan Golubar

asked on

Href not redirecting to the file in same directory

I have "change_pass1.php" file in same directory file where next line of code is
	$changePass_btn = '<a  href="change_pass1.php">Change password</a>';

Open in new window

but link is not working. Why?

I did try also other files in same directory and is the same. I did try to call an not-existing  file and i may see the path in the browser, but when i am calling my existing  file browser does not redirect me (it stays on the same page-path in browser does not change).
Avatar of Robert Granlund
Robert Granlund
Flag of United States of America image

$changePass_btn = '<a  href="change_pass1.php">Change password</a>'; Change to.
$changePass_btn = '<a href="change_pass1.php">Change password</a>';

Also, maybe the relative path is wrong?  Can you share a link?
Check you don't have a somewhere in your code otherwise your links would be relative to that.

  <base href="http://www.yoursite.com/">
Avatar of Leonidas Dosas
Change the href="change_pass1.php" to href="/change_pass1.php" or  href="./change_pass1.php"
Avatar of Ivan Golubar
Ivan Golubar

ASKER

With:
href="/change_pass1.php

Open in new window

i get in browser next link http://my.com/change_pass1.php (part in link is missing:http://my.com/wp-content/themes/aaa/bbb/change_pass1.php)

in other case:
href="./change_pass1.php

Open in new window

page does not redirect me.

Originally my site is Word press I have different Themes and i am making one mine.
What is the browser link with
href="change_pass1.php"

Open in new window

http://my.com/wp-content/themes/aaa/bbb/user.php?u=ivan


(the same as it was before clicking on link)
I assume you're already calling get_template_directory_uri() in your code to let WP know where your current template lives?
SOLUTION
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't remember it, because i am doing this template almost one year now.
But i added it now to main page where in Onload  function.
But still no result.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you

I get next in browser:

http://my.com/wp-content/themes/my2/my3/%3C?php%20echo%20home_url();%20?%3E/about-us

Open in new window



What does it mean?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes i understand now.

The problem is not in the link to the *.php

But that code in *.php is  incorrect.