Error after transfer from local host to online hosting (HTML PHP) - php

Recently, i transfer from localhost with xampp to online host using cloud hosting. But then I encounter some error related to the direction of a file. For example, when using in localhost, the URL for directing from the homepage to login: localhost/login. But when I using in the cloud hosting it then become domain.name.com/homepage/login.
This lead to the 404 error. The html code for the file is the same when using in localhost and cloud hosting.
Login

It is better to give the path from the current file location.
Like you can access the files in the same folder using file.php
You can access the files in another folder using folder_name/file.php
You can access the files in parent folder using ../file.php
Thank you

Related

PHP links working in local host but breaking when hosting application on web server

I have web application. i am using WAMP server.
I have developed web application and put my application files under "login" and then in "www" folder of wamp.i.e. Drive:\wamp\www\login\
now when upload my file to the web host that goes directly to "www" folder and there is no "login" folder there. so my existing links on localhost e.g.
http://localhost:8081/login/dashboard.php
turning to http://example.com/login/dashboard.php.
now as there is no login folder, because of wrong path, link is breaking.
there is one way, that i change every link everytime before uploading to webserver, which is time consuming and prone to errors.
is there any simple way i.e. dynamic way that my links work perfect both on localhost as well as web server.
so that the link on localhost on web server the link should be http://localhost:8081/login/dashboard.php direct automatically to http://example.com/dashboard.php instead of http://example.com/login/dashboard.php
i tried using $_SERVER["DOCUMENT_ROOT"] but it point local drive path and did not work well for me..
any help really appreciated.
Have you tried to work with relative paths?
$path = "/login/etc..."
This way you don't have to change the paths each time. I think php even has a function to turn relative paths to absolute ones.

how to upload php website into remote server

I am new to deploying websites to a remote server. I have been searching for the steps that I should follow to do that for a long time but have not found any results.
here is what I have done 'til now:
1- I used a free web hosting called 0fees.us.
2- Got sub-domain name from the web host.
3- Upload my files as .zip in htdocs directory using the online file manger in cPanel.
4- Upload my database using mysql in cPanel.
5- Change the database configuration in the my website.
After that I typed the sub-domain in the URL field but it get a browser error says:
the connection to the server was reset while the page was loading
What else should I do, so I can type the domain name I see my website on the browser?
Change/configure nameserver settings that points domain to your server ip address.Delete the default index page. And rename the main page you want to display initially to index.html or index.php

I setup a simple upload site but uploads only work one-way when not on localhost

I've set up a simple upload site in php using a mysql DB, and apache.
I am using no-ip.com to hide the ip.
When my friends upload their file, I receive it on my end, but they are un-able to view it on their end. I think this is because mysql DB isn't "server-side"? I'm unsure what to do at this point.
some of the Code: (as you can see it's mysql dependant)
index.php:
videos.php:
this is all in my wamp 'www' directory, and all completely functional while it's local.
However, when online people can not view videos or images that they have uploaded.
Any help is greatly appreciated as I'm very new at this and simply trying to learn.
localhost is an alias of 127.0.0.1 which is your local machine, when people try and click a link to http://localhost/file.php they'll actually be trying to access file.php on their own computer. You need to use your public ip instead of localhost.
Thanks AlphaDelta, I changed the $url to my public ip address, then I was getting the forbidden error from ip address' outside of lan, and I went into the 'httpd.conf' file of apache and changed the line "Require local" to "Require all granted".

How to modify /xampp added to website url after File Transfer from localhost

I have recently transferred my files from localhost to a web site. I used XAMPP to develop the files and transfer them to the web host. Everything is working fine except that /XAMPP was somehow added to the URL and has prevented access to the main web page. Any ideas on how to modify/remove this would be appreciated. Thanks!
So my webpage www.webpage.com now becomes www.webpage.com/xampp and I need to change the path to a login page from the xampp path
Thanks!
Then, only move files inside htdocs/ to your webserver. Remove other
uploaded files first. After this, try again accessing your
application.

php MySql login system in dreamweaver

I currently have the following problem and was hoping that you could help me. I am busy building a website with a login system in Dreamweaver cs5. My login is created and I set up my testing server as the domain I am creating the website for.
This testing server does connect successfully. After this I am trying to establish a MySql connection. I insert my connection name which is dbConfig as well as the information of the MySql database that I set up on cpanel for this domain. I then get the following error:
HTTP Error code 404 file not found.
I don't know where to go from here as I have never worked with php or MySql before and am unsure of where to go from here.
If it is parent domain then you need to upload your files to "WWW" folder from FTP. There might be a case where you may not see "WWW" folder. Some hosting cpanel have different default folder to upload files. For Example: Godaddy hosting cpanel has "html" folder where you can upload your files. But almost all other hosting has "WWW" folder. If you are uploaded to subfolder For Example: www/test then to access your files you need to check like "http://example.com/test/" . OR if it in root folder then you just need to go to your domain url "http://example.com"

Categories