404 means the file does not exist. Make sure the file is uploaded to the same location you are trying to view in the browser, and note that our servers are cAse sEnsiTivE.
Both files are in the root directory as you can see in the screenshot, I have not seen any issues like cAse sEnsiTivE, and the SQL database connection settings are also correct.
RewriteEngine On
RewriteRule ^$ /wallpaper/fantasy/index.php [L]
Remove "index.html" from the end of the URL
RewriteCond %{REQUEST_URI} ^(.*)/index\.php$ [NC]
RewriteRule . %1/ [L,R=301]
Remove specific filenames from the end of each URL
RewriteCond %{REQUEST_URI} ^/(.+)\.php$ [NC]
RewriteRule . /%1/ [L,R=301]
except this path: /wallpaper/fantasy/index.php
both the pages crashed: /wallpaper/anime/index.php , /wallpaper/vector/index.php
I think problem is not lies in .htaccess
I need to write new code to connect html and php to upload data in sql, Interesting thing is I can go to infinityfree server and can use insert command to upload the data in SQL but I want to give visiter an option to insert there own data to SQL Table.
Iâm sorry, but I donât fully understand what the desired situation is exactly, or what you see instead.
The Anime, Vector and Anime pages all seem to be working fine from here, but I donât see any upload functionality on any of the pages. Can you tell us what URL, button or link triggers the 404 error?
Iâm sorry for the misunderstanding. All the files are and were showing. I previously had an issue with upload.php and userform.html, which were supposed to insert data into the SQL database. However, upload.php was not able to connect to the SQL database, causing a crash that triggered a 404 error. Currently, I have removed both the files âupload.phpâ and âuserform.htmlâ and am working on new ones.
PHP is unable to establish a connection with the SQL database. Iâm trying to insert data through a simple HTML form and PHP, but causing 404 error. After clicking the âSubmit Dataâ button in the âindex.htmlâ link that is supposed to trigger âinsert_data.php,â it triggers the file, but âinsert_data.phpâ is unable to establish a connection with the SQL database causing 404 error.
Thank you! I can see nothing wrong with the code, it should work fine.
The redirect to 404 is caused by your .htaccess rules; this is because while the .php (and .html if youâre using the code shared above by @Greenreader9) extension is stripped from the URLs, the new URLs are not internally rewritten to load the PHP/HTML files, so the server tries to load files that donât exist and redirects you to the 404 page.
Adding this below the PHP redirect code should help:
Try replacing your .htaccess code with the code I gave you.
I think what is happening is this:
The forum is submitted to https://www.DOMAIN.space/insert_data.php1
.htaccess takes over and redirects to https://www.DOMAIN.space/insert_data/2
Notice the backslash on that last link, which tells Apache to look for a directory, not a file. Since no directory exists with the name âinsert_dataâ (And, consequently, the file at /insert_data/index(.php/.html) does not exist), a 404 is thrown.
Using .htaccess code that is confirmed to work here should fix this, or at least eliminate .htaccess as a cause.
1
2
(No clue why you get a 302 here, that folder clearly does not exist ref)
Also, you need to remove the brackets from the name attributes in the HTML, or updated your PHP
The code you gave above seems to be broken; I tested it on my own account and it threw Error 404s until I added the lines mentioned in my message above.
Perhaps Iâm doing something wrong? I updated it to your code again, try visiting http://do.epizy.com/info.php.
I did apply changes to .htaccess and now it is inserting data to SQL. Thank you so much for that.
But now I am facing new issue, my website url is âDOMAIN.spaceâ and after adding it to browser it use to open âDKMAIN.space/wallpaper/fantasy/index.php but after applying your .htaccess code it showing me âwww.DOMAIN.spaceâ hiding âwallpaper/fantasy/index.phpâ from url but I just want to hide âindex.phpâ from the end of url, and when going to other directory like âwallpaper/vector/index.phpâ or âwallpaper/anime/index.phpâ it crashed both the page,
Just to be clear âindex.htmlâ in root is not my home page file itâs form that trigger âinsert_data.phpâ
my current .htaccess: