Custom PHP page not accessible by href link.

DLJonsson

Well-known member
I've a custom php file called beta.php
I've created a custom page as follows
Page Name : Beta
Enabled : [X]
Type : PHP
PHP Source File: beta.php

Href Link field though does not work for me.

I can access beta.php from the side bar menu no problem,
I can see that the URL it uses is
https://[mysite]/index.php?function=show_static_page&id_static_page=5#

If though I enter the URL it generates into the Href Link field, it still returns a
status 404.

How though can I access beta.php simply as https://[mysite]/beta.php

Href Link as https://[mysite]/index.php?function=show_static_page&id_static_page=5# - does not work - how can I make a human friendly link directly to this custom page?
 

eugenio

Administrator
Staff member
Hello,
a link like:
https://[your site and dadabik path]/index.php?function=show_static_page&id_static_page=xxx

should work without problem, if you see it when you click on the related menu item, there is no reason it shouldn't work if you call it from another link, could you double check the link? The final # shouldn't be there but this is not something that should affect the execution of the page.

It is strange that you can directly access https://[mysite]/beta.php

1) Are you sure the file is in the folder custom_php_files?

2) Are you sure you didn't delete the first line of code, the one having this comment?
// don't delete this line, this must be the first line of your code

Best,
 

DLJonsson

Well-known member
I can verify the following.

1. the beta.php file is in custom_php_files

2. "don't delete this line, this must be the first line of your code"
1st line of php code is included as specified.

From the menu it loads not problem. The link though is not human friendly link
ie https://[mysite]/index.php?function=show_static_page&id_static_page=5
rather than simply
https://[mysite]/beta.php

The Custom Pages form is intuitive enough.
A question that though that remains is what is the syntax of the 'Href link' field?
should that be
https://[mysite]/index.php?function=show_static_page&id_static_page=5 ?
or ?

Please advise
 

eugenio

Administrator
Staff member
Hello,
sorry I don't understand your question, I am not sure if

1) You are having problems using this link:
https://[mysite]/index.php?function=show_static_page&id_static_page=5
i.e. the link doesn't work OR

2) the link works but you want the URL to be something like https://[mysite]/beta.php

If it's 2), you cannot do that. You could create a simple beta2.php page that just redirects to
https://[mysite]/index.php?function=show_static_page&id_static_page=5
but I don't know if this is what you want.

About the last question: you should use the "href link" parameter only if you use "int. link" or "ext. link" as TYPE, otherwise you don't have to set this parameter.

Best,
 
Top