Page 1 of 1

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

Posted: Sun Sep 03, 2023 6:53 am
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

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

Posted: Sun Sep 03, 2023 8:10 am
by Pablo
Are you suggesting that the extension should not be removed from the PHP links?

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

Posted: Sun Sep 03, 2023 8:24 am
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.

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

Posted: Sun Sep 03, 2023 9:15 am
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.

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

Posted: Sun Sep 03, 2023 2:29 pm
by wwonderfull
Well is there any workaround for it if it can be thought.

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

Posted: Sun Sep 03, 2023 2:36 pm
by Pablo
Currently, the only workaround is not to hide page extensions.

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

Posted: Sun Sep 03, 2023 3:40 pm
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.

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

Posted: Sun Sep 03, 2023 3:48 pm
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.

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

Posted: Sun Sep 03, 2023 4:47 pm
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.

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

Posted: Sun Sep 03, 2023 4:55 pm
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.