Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

[SOLVED] Getting 404 in iFrame Fields


Reply

2 Posts   1722 Views

Avatar
banal

1 March 2008 at 2:05am (Last edited: 1 March 2008 7:29am), Community Member, 901 Posts

Hello all

I'm experiencing strange problems after moving my SilverStripe Site from my local server to a Webserver.

The site works fine, however if i log into the Backend, i get a "Page not found" Page inside the Image Upload and other IFrames. The URLs that cause the Error are formed like this:
http://<www.mysite.com>/images/iframe/Person/22/Photo

I don't have the slightest idea what could cause this error. Please help me out.
Thanks

Avatar
banal

1 March 2008 at 7:29am (Last edited: 1 March 2008 7:30am), Community Member, 901 Posts

I was able to solve the issue myself.

Somehow, the .htaccess File that comes with SilverStripe isn't compatible with all Apache Versions or doesn't work on all configurations.

This was running on a subdomain eg. http://sub.somedomain.com
Original rewrite rule:

RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [ L ]

Which i replaced with

RewriteRule ^(.*)$ sapphire/main.php?url=$1 [ L,QSA ]

It does basically the same, i just rewrote it with my limited mod_rewrite Knowledge. $1 is the match from the rewrite Rule, the QSA flag keeps Query Strings and sends them to the rewrite "Target" as well. Maybe i should file a ticket for this...

After that, iFrame Fields were showing up nicely. The base href tag was broken on all these pages though (same goes for urls with action and parameter, eg. with multiple slashes)
I fixed this, by adding the following Line into my _config.php file (in my setup it was located in the mysite folder)

Director::setBaseURL('http://sub.somedomain.com/');

Replace http://sub.somedomain.com with your domain :)
Hope that might help somebody.