Should I delete my old files from my server after a redirect?

M4DM4X

Elite Member
Joined
Jan 21, 2015
Messages
2,909
Reaction score
1,753
Hi,
I am redirecting all my .html files to their .php equivalent. I added a 301 redirect rule in the htaccess.
Should I delete the html files from my server or keep them since they are indexed and rank well?
I'm afraid if I delete them, they will be removed from the index, and meanwhile if php files are still not indexed I will lose ranking.
Keeping them both on the server, with the 301, should be fine for google not to see duplicates, isn't it?
Thanks
 
I would remove them after php files take their place in the SERPs.
Thanks, I am for this one too.
Chatgpt suggest this too, even if it says there is no problem deleting the html files if the 301 redirect is well implemented.
To be extra sure there won't be any duplicate issue it suggest to put this in html files

<!-- Inside your .html files -->
<link rel="canonical" href="https://www.yoursite.com/page.php" />

Which is a good idea

This should be the way to go. Wait till they're replaced on their ranking.
Yes. Though, we are talking about 50k urls to wait for indexing :D
 
You're thinking the right way, no need to rush deletion. With a clean 301, Google will eventually pass equity, but it still relies on crawling and cache updates.

Keeping the old .html files online for a while helps preserve current rankings during that handoff. Canonical tags inside the old pages pointing to the .php versions is smart, especially if you're managing a large set like 50k URLs.

Once you're confident most .php versions are indexed and stable, then you can clean up the .html safely. Patience here saves rankings.
 
Thank you guys for your help, I think I am good to go now :)
 
You should keep the .html files for now. Since they're already indexed and you’ve set 301s, Google will pass the SEO value to the .php pages. Once the .php URLs are indexed in for your site and get ranking. Then you can safely delete the .html files. No SEO could not be harm as long as your 301 is in place. Do you understand bro???
 
chatgpt suggest this:-
Yes, you can safely delete the .html files after setting up proper 301 redirects to the .php versions. The 301 tells Google the content has permanently moved, so your rankings will transfer to the new .php pages over time.


Do not keep both files—even with 301s, Google may still crawl both and it could create confusion or delays.


Just make sure:


  • 301 redirects are working correctly
  • .php pages have the same or better content
  • Internal links now point to .php pages
 
If the 301 redirects are working properly, you can safely delete the .html files.
 
When will your new links got ranked then you should remove the old files, otherwise your redirection will not take any advantage for you.
 
My experience is to always check the server log and Google Search Console to monitor the crawl rate of old and new URL. When the new URL is indexed stably and traffic is transferred, delete the old file to avoid losing ranking
 
Yes, after confirming that redirects are working correctly and old URLs are indexed properly, you can safely delete old files. This reduces server load, improves security, and ensures users and search engines access only updated content.
 
Back
Top