Why are my files being removed after they've been uploaded?
When you upload a file, the process is done, yet the file is instantly removed. One of the following issues is typically to suspect:
There is no htdocs folder for the file.
All website files must be uploaded to the main htdocs folder or the domain specific htdocs folder (for instance, website.com/htdocs).
You simply wouldn't be able to upload files to any of your account's other folders. If you attempt to generate or upload files elsewhere, they will be instantly removed.
The file type you have selected is not permitted.
For security and fair usage reasons, some file types, such as .exe files, are prohibited on ProFreeHost. Other files may be restricted, but regular website files are allowed.
If you want to make something available for download or embed a video on your website, kindly do it through a dedicated file sharing or video streaming service.
Malware is present in the files.
Uploaded files are checked for viruses automatically. If malware is found in a file, it is removed automatically to protect your website and visitors.
The file size limit has been exceeded.
All files on the ProFreeHost web servers are limited in size. The file is automatically erased if its size exceeds the limit. The following size restrictions apply:
- HTML and PHP files are restricted to 1 MB.
- The size of .htaccess files is restricted to 10 kB.
- All other files must be under 10 MB in size.
Please keep in mind that this is a file size restriction, not a PHP upload restriction. This restriction applies to all files on your account, regardless of how you try to acquire this file onto your account.
How to reduce the size of HTML and PHP files
- You may be able to reduce the file size in one of the following ways, depending on the contents of your PHP/HTML file:
- If the file has a lot of CSS and Javascript code, try splitting it up into other files and connecting them from the same page. Separated CSS and Javascript files may be cached more efficiently, which will help your website load faster.
- If the HTML page has a lot of data that needs to be presented to visitors, consider moving it to separate text files or a MySQL or SQLite database that PHP can query.
- If the file includes a lot of coding, you may even be able to split it up into different files and use PHP include or need directives to bring it all together in a separate process. This makes it easy to progressively replaced across numerous pages and to read and comprehend the code in general.
- Use PHP include or need directives to integrate numerous HTML files, such as headers and footers, into a single page if the file contains a lot of HTML code. However, a huge HTML page may take a long time to load and consume a lot of bandwidth, which is inconvenient for visitors. As a result, you might want to rebuild your website such that the material is dispersed among many, particular pages.
How to reduce the size of other files
Please consult the article How to upload larger files/archives for solutions if you wish to upload a large archive (.zip, .rar, .tar.gz).
Consider separating text files into many files and providing them individually or merging them using PHP on demand for text files.
You may be able to select a different encoding (e.g., MP3 vs. WAV audio) or use better compression to lower the file size for media files. Alternatively, you may host the content on a specialist photo/music/video/etc. hosting service and link to it from your website.
How to reduce the size of .htaccess files
A large .htaccess file can have a negative impact on server speed, slowing down your and other people's websites. As a result, large .htaccess files should be avoided wherever possible.
A few frequent use cases for large.htaccess files are shown below, along with workarounds.
You would like to prevent harmful bots from visiting your site
Filtering and denying access to certain User Agent information given by the client is a standard approach to stop malicious bots. For a variety of reasons, such .htaccess rules are often of minimal utility and should be removed:
Because Free hosting already includes a security system to keep out bots, which works more successfully than a user agent filter. User agents are freely modifiable by the client, and many terrible bots pretend to be popular browsers on common operating systems, which cannot be discovered by such filters. As a result, you may safely remove these lines and be certain that your website is currently more secured.
You would like to limit access to specific countries
Allowing or denying access to IP addresses in specific ranges is one approach to restrict access to your website to specific nations (either blacklisting or whitelisting specific areas).
Moving the IP blacklisting/whitelisting to PHP code, from which you can additionally filter IP addresses, is a good way to deal with issue.
However, it should be highlighted that employing IP ranges to limit countries is fundamentally problematic. Network operators are given IP ranges, which they can use wherever they wish or even in many places at the same time.
It is hard to have a precise list of which countries' IP address ranges belong to. You may also utilize a GeoIP service from PHP to obtain more precise location information for individual IP addresses.
Finally, it is much easier to alter what individuals see if they are banned using PHP code. They would only get a generic "403 Forbidden" page if they used a .htaccess file.
You have got a lot of rewriting rules
You may have a big collection of rewrite rules to send certain URLs to specific pages if you have created your own program. This is an appropriate technique to manage routing in your application, but as your application develops larger, it may result in very large.htaccess files.
Routing is handled by most frameworks and CMS from inside PHP. As a result, all page requests are forwarded to a single index.php file, from which PHP code determines which code to run for each URL.