简体   繁体   中英

Using htaccess to include PHP in HTML files

Is it still considered to be an OK practice to use htaccess to render PHP in HTML files for things like a navigation/menu?

I used to do it back in the day for smaller sites that didn't really need a CMS, but I wasn't sure if it's a faux pas these days.

It's purely up to you. It doesn't pose any threat to your site or expose any vulnerability so it doesn't matter either way. Rendering a PHP file with an HTML extension is no different than one with a PHP extension.

In fact, if you're migrating a static site to dynamic one, it's actually a good way to preserve page URLs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM