Avatar of Richard Korts
Richard Korts
Flag for United States of America asked on

Link not working properly

We have a registration process for new users that involves several steps to avoid shaming. We have our main site at www.lakoshvac.com, our development site at www.lakoshvac.com/dev. We ae in the process of adding new features on te development site for rollout on Jan. 7. One piece of this involves a step in new user registration. When we test in dev, it winds up linking to the equivalent place in the live system.

Specifically, see attached image. Note in the lower left, just above the windows bar, the link "www.lakoshvac.com/dev/user_ok.php?cd=eXow0G". This link is activated when the upper "Allow Pricing" link (after Trade Pricing) is clicked.

It winds up going to the live version at www.lakoshvac.com/user_ok.php?<etc>, which fails because the cd=eXow0G makes it look for a registered user record with at "code" in the LIVE database.

The only thing I ca think of that remotely could be effecting this is in the generated email, the link is specifically spelled out like this:


<a href='http://www.lakoshvac.com" . $locusr . "?cd=" . $r['ccode'] . "'>Allow Pricing</a><br><br>";

I am thinking that the http (should it be https?) might be the problem.

Anyone see anything that could make this happen? Also attached is source of user_ok.php

user_ok_issue.png

user_ok.php

HTMLPHP

Avatar of undefined
Last Comment
Chris Stanyon

8/22/2022 - Mon
Scott Fell

I think you are going to run into issues when your dev site is just a sub folder.  I would put your dev site on a subdomain. Then in your config.php file where you have your database info you can look to see what the sub domain is. If it is "dev." then use credentials for your dev database. If it is anything else, use the live database. Then you can put the same database config file in either spot and you don't have to worry about over writing the file or using the wrong database.

You can do the same thing just by testing if the url starts with "www.lakoshvac.com/dev" but I feel the subdomain is a cleaner option.
Richard Korts

ASKER
Scott, thanks, but I can't go through the monumental task of doing all that just to make this work. It's 5 minutes to midnight.

The basic question is, if the link says 'www.lakoshvac.com/dev/xyz.php', why does it go to "www.lakoshvac.com/xyz.php"?

We have been using the subfolder idea for years & it works, except in this case.

Thanks,

Richard
Scott Fell

I am lost.

Specifically, see attached image. Note in the lower left, just above the windows bar, the link
I see your email that looks to be generated from the code, but what I am looking for?

Is the issue the links are wrong?

If so, then you just need to know if you are in the dev folder and do the same thing I explained.

I am thinking that the http (should it be https?) might be the problem.I am thinking that the http (should it be https?) might be the problem.
I don't think this is the issue in the question, but you should be using https.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
David Favor

1) I'm with @Scott, I always run host.domain.com, so dev.lakoshvac.com as this avoid all manner of oddball problems that can be near impossible to debug.

In your case, you'll have to go through your entire site to ensure no https://www.lakoshvac.com (main site) logic is interfering with https://www.lakoshvac.com/dev logic.

This can be very complex, as subfolders inherit all your main site rewrite rules.

2) You asked, "The basic question is, if the link says 'www.lakoshvac.com/dev/xyz.php', why does it go to 'www.lakoshvac.com/xyz.php?'" which likely occurs because some sort of Rewrite logic is firing at the main site level.

There are 2x ways to debug this.

a) Enable deep logging of + debug your rewrite logic, which could take many hours...

b) OR... move the folder install to a hostname for a likely... fix... in a few minutes...

3) Me personally, I avoid Rewrite Engine conflicts like the plague, as they take forever to fix... then 1x fix can create entirely new problems... so a fix you add for the dev folder may destroy your main site.

4) You mentioned, "We have been using the subfolder idea for years & it works, except in this case."

If you just made this folder a WordPress install, this statement is untrue... because...

Static Files != WordPress Install.

If you've always had your dev site running out of a folder, minor changes to main site could have effected how the dev folder works...

5) Tip...

Only Thrillseekers do folder installs...
Scott Fell

David, this is not Wordpress.

Richard, If I cerf to https://www.lakoshvac.com/dev/user_ok.php?cd=eXow0G I get below.

First, I feel this page should throw an error if you just click it. I would add key/token unless that cd=eXow0G is already unique.  More importantly, it is not redirecting, just the error. If it is redirecting for you, something is going on between line 30 there and beyond.  


ASKER CERTIFIED SOLUTION
Chris Stanyon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question