Trying to uploading data using PHP and HTML form to SQL DATABASE

Thanks for verifying my php to sql file,

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:


RewriteEngine On

RewriteRule ^$ /wallpaper/fantasy/index.php [L]

RewriteCond %{REQUEST_FILENAME}^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,NC,L]

RewriteCond %{REQUEST_FILENAME}^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,NC,L]

Solution:

RewriteEngine On

RewriteRule ^$ /wallpaper/fantasy/index.php [L]

RewriteCond %{REQUEST_URI} ^(.*)/index\.php$ [NC]
RewriteRule . %1/ [L,R=301]
3 Likes