Is it possible to use an htaccess file to allow iframes within one directory?

Melody Scott
Melody Scott used Ask the Experts™
on
Hi, the server for my site is set to disallow frames. Site is https://   magickitchen.com.

Is it possible to use an htaccess file to allow iframes within one directory? If so, how? Thanks in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018

Commented:
Post your current htaccess please

Author

Commented:
Here it is with the suffix .txt.
.htaccess.txt
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
No.  iFrames are accessed thru the web browser.  The web server does not even know about them.  To the web server, it is just another file.
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
When a site does not want to be iframed it has a few options for doing this - one of these is for the server to send the header (this is what your site is doing)
X-FRAME-OPTIONS: DENY

Open in new window

This tells the browser not to allow content in an iframe for that site.

For you to be able to do what you have requested we would need to know where this header is being set. Then you would need to override that header for the folder you want iFramed.

The question is : do you want to open the iframe for anyone (any origin) or only for pages that originate from your site?

By setting
X-FRAME-OPTIONS: SAMEORIGIN

Open in new window

You can iFrame your own pages while still denying iframe requests from pages originating from other domains.

You can read more about X-FRAME-OPTIONS here https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

Author

Commented:
So I should ask the person who handles the server to make a change like this: https://serverfault.com/questions/854461/apache-config-allow-iframes-only-for-a-specific-directory  on the server.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
If that is how it has been implemented then that would be the fist port of call.

Author

Commented:
Thanks, all!
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You are welcome.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial