How to access the home page of WordPress from a cPanel staging URL

浪尽此生 提交于 2021-01-29 13:56:22

问题


I have a cPanel hosting package, and the staging url is this format: https://cpanelserver.com/~cpaneluserid/.

This does take me to my WordPress site. However, it takes me to the WordPress page "Oh no! No content is appearing for this page!".

Obviously the /~cpaneluserid/ part of the staging url is not recognized by WordPress as a valid page name.

If I try to tack on an interior page name like this: https://cpanelserver.com/~cpaneluserid/about-us/, I still get an "oh no" unrecognized page error.

I don't reach my website if I try removing the the cpanel userid from the url like this: https://cpanelserver.com/ or remove the tilda like this: https://cpanelserver.com/cpaneluserid/.

Has anyone been able to use a staging URL with a WordPress website from cPanel hosting with this same URL format?

UPDATE:

Because my cPanel 'staging URL' has the user-id as a sub-directory, as in this format: https://cpanelserver.com/~cpaneluserid/, that means that no one with a WordPress site will be able to use this staging URL format.  That is because WordPress interprets the /~cpaneluserid/ as a page name.

And trying to navigate away from this invalid page (page with no content) doesn't work, as this coding: <?php bloginfo( 'url' ); ?> will always return https://cpanelserver.com/~cpaneluserid/, so the new page link will give you this URL: https://cpanelserver.com/~cpaneluserid/newpage/, showing the 'newpage' as a sub-directory of this invalid page '~cpaneluserid'.

Instead, the hosting company should be creating the staging URL with the user-id as a sub-domain, as in this format: https://cpaneluserid.cpanelserver.com/.

I just heard from my hosting company, and they had this excuse: "Unfortunately we are not providing a staging URL on the cPanel platform due to the number of potential security risks that are associated with it."

So basically no-one with a WordPress site on a cPanel hosting package can show their clients their website design, to get their approval, before they go live.

I am not sure why the hosting company thinks that this url: https://cpanelserver.com/~cpaneluserid/ is any less risky than this one: https://cpaneluserid.cpanelserver.com/?

So it looks like there is no answer for this post.

But now I am curious how other cPanel hosting companies deal with this 'security risk' of having a valid staging url.. or do they all use the same format as mine?

 


回答1:


I finally solved the problem.

It turned out to be a rooky cPanel user mistake!

I had used the cPanel server name for the WP_HOME and WP_SITEURL WordPress settings (ie: https://cpanelserver.com/), instead of the actual location of my hosting package on the cPanel server (ie: https://cpanelserver.com/~cpaneluserid/).

The way I had the settings meant that WordPress ignored the part of the URL that was the defined as the siteurl (ie: https://cpanelserver.com/), and treated everything after that as a page name (ie: /~cpaneluserid/).

So when I used https://cpanelserver.com/~cpaneluserid/. to view the site online, the cPanel hosting package correctly got me to the root of my website location, but WordPress didn’t take me to the home page, instead it took me to the non-existent /~cpaneluserid/. page.

If I had gotten the server name wrong in the WP settings, then I would not have been able to see my site, and would immediately know it was an issue on my side, and would have figured out this issue sooner.

But since I had the server name correct (even though the url was incomplete), I was able to view my site, and know that the database was correct.. so I erroneously thought that my WordPress settings were also correct. Instead, I was thinking that the page presentation & navigation issues where a problem with cPanels temporary URL format.

So in case anyone every has the same problem, I wanted to document it here.

IF you are using your cPanel's staging (or temporary) URL to access your site before it goes live, then BE SURE TO use the full URL that points to your cpanel hosting package - which should include your cPanel user ID as in: ‘https://cpanelserver.com/~cpaneluserid/’ in the WordPress settings of WP_HOME and WP_SITEURL.



来源:https://stackoverflow.com/questions/63821610/how-to-access-the-home-page-of-wordpress-from-a-cpanel-staging-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!