After hiding the Extensions the Success or Error Page does not show

Issues related to forms.
Post Reply
User avatar
wwonderfull
 
 
Posts: 1558
Joined: Fri Aug 21, 2020 8:27 am
Contact:

After hiding the Extensions the Success or Error Page does not show

Post by wwonderfull »

@pablo
I have checked the Hide file extensions for internal links

As it removes extensions such as html and php from the script it also did same for the php form script as it is the purpose to do so which is expected.

}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'contact_grid')
{
$mailto = 'example.com';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = '';
$message = ':';
$success_url = './success';
$error_url = './error';


PHP Warning: file_get_contents(./success): failed to open stream: No such file or directory in /home/u********/domains/domain.com/public_html/index.php on line ***

Success and error page both are in the same folder as the index page directory.

I manually edited
$success_url = './success';
$error_url = './error';

in to

$success_url = 'https:// domain.com/success';
$error_url = 'https:// domain.com/error';

then it works but that does not serve the purpose of the advanced option to Hide file extensions for internal links. Because then I have to use the absolute links although it says No such file or directory which does exist but has to be directed with absolute link but when it is done using ./pagename it does not seem to work. But if the Hide file extensions for internal links is turned off it works fine but with extensions.

Here is the demo: https://temp-file.org/dUAr6PdJch7VhVX/file
Last edited by wwonderfull on Wed Feb 14, 2024 2:54 am, edited 2 times in total.
User avatar
Pablo
 
Posts: 23234
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by Pablo »

Are you suggesting that the extension should not be removed from the PHP links?
User avatar
wwonderfull
 
 
Posts: 1558
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by wwonderfull »

Pablo wrote: Sun Sep 03, 2023 8:10 am Are you suggesting that the extension should not be removed from the PHP links?
I was saying if extension is removed it does not show the success page or error page and wanted a solution. From the code it does remove the .html or .php but the pages do not show.

I wanted to hide the extensions which it did but the page did not direct.

./success should do the same as ./success.html but the ./success is not working I think.
User avatar
Pablo
 
Posts: 23234
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by Pablo »

I think it's best of the extension is not removed from links in PHP code. it looks like the server cannot handle this.
User avatar
wwonderfull
 
 
Posts: 1558
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by wwonderfull »

Well is there any workaround for it if it can be thought.
User avatar
Pablo
 
Posts: 23234
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by Pablo »

Currently, the only workaround is not to hide page extensions.
User avatar
wwonderfull
 
 
Posts: 1558
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by wwonderfull »

What if in the form we see the success and error page url where it asks us to select the both pages, what if we could manually write the direct url for example as I tested the url worked.

$success_url = 'https:// domain.com/success';
$error_url = 'https:// domain.com/error';

So the success and error page are being called with the absolute url from the directory.

Absolute url's work without extensions as I had tested. It could be a solution.
User avatar
Pablo
 
Posts: 23234
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by Pablo »

I am not sure if this will if the script also needs to processed variable on the success or error page.
Usually this will throw a security error. I think absolute links will only work for redirect.
User avatar
wwonderfull
 
 
Posts: 1558
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by wwonderfull »

Another thing I noted is that although extensions are removed from the form as I have set target _blank it opens a new window tab

and the url looks something like this. https://example.com/index.php (and the success page shows on that url)

I was thinking if the extension is removed via htaccess or even directly from wwb how does the target get to the index along with the .php extension at the end.
User avatar
Pablo
 
Posts: 23234
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: After hiding the Extensions the Success or Error Page does not show

Post by Pablo »

The actual file still will have the php extension otherwise the server will not know what type of file it is dealing with.
Post Reply