You might worry why those settings are not applied by system if you run your query from portal environment.
According the documentation:
http://help.sap.com/saphelp_nw70/helpdata/en/33/39fa40ee14f26fe10000000a1550b0/frameset.htm there is important property, BEx Web Application Query String, set automatically for the BEx Web Application Designer and the BEx Query Designer. You need to enter these properties manually in the Portal Content Studio:
Then you will be running the same web template on portal and with your raw URL query links.