Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to PHP includes?

I have a client who has built her entire site using html extensions. As such, renaming files and changing links just isn't an option. I need a way to include a footer file into each .html page. I've read a bit on the subject and initially thought html includes would be fine, but then realized they are only valid if the file extension is .shtml or something else. So are there any other alternatives? Any help is greatly appreciated.

like image 518
Willem Ellis Avatar asked Mar 16 '26 08:03

Willem Ellis


1 Answers

An .htaccess rule would work, if you setup 301 redirects it will notify search engines of your change and there should not be any seo repurcussions. This will redirect that for you. The other benefit for seo is php includes are server side so the html will be passed to the search engine spider for index, where javascript will execute after the document loads, and most spiders are not going to execute your JS, just index the html passed down from the server.

    RewriteEngine on 
RewriteBase / 
RewriteRule (.*).htm$ /$1.php [R=301,NC]
like image 115
user1289347 Avatar answered Mar 18 '26 21:03

user1289347



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!