PDA

View Full Version : BrowserManager AND Apache mod_rewrite


halfasleeps
01-26-2009, 08:35 PM
I have my flex project on a page that the real location is mydomain.com/mothers_rings_flex.php
but I want to use mod_rewrite to pretty that url up a bit to instead look like mydomain.com/mothers-rings/

Once I do that, I have to set a base tag in the header with an href of something like "mydomain.com/mothers_rings_flex.php" that way it will embed assets relative to "mydomain.com/mothers_rings_flex.php" and not relative to "mydomain.com/mothers-rings/" otherwise if I wanted to embed a file at mydomain.com/images/myimage.jpg with a relative url like src="images/myimage.jpg" then it would actually look for the asset in this absolute path: "mydomain.com/mothers-rings/images/myimage.jpg" But that base tag takes care of that.

BUT whenever the BrowserManager initializes, it ALSO changes the url to be exactly what the base tag says. so instead of init() changing it to mydomain.com/mothers-rings/# it redirects it to mydomain.com/mothers_rings_flex.php# (or whatever is in the base tag).

So it seems like the 2 can't co-exist?
I know the easy answer would be, just use absolute paths when embedding assets, but the page is a template used through the entire website and can't be changed for the one page.

So I am wondering if anyone has faced this issue and knows of a possible work around?

THANKS!

drkstr
01-26-2009, 11:28 PM
I pass the directory path down to the SWF with Flash vars, then dynamically create an absolute path which gets stored in a static settings class upon initialization.

IE.

src="{GlobalSettings.ASSET_PATH}/my_img.png"


Does this work for your situation?


Best Regards,
~Aaron

halfasleeps
01-28-2009, 01:17 PM
I pass the directory path down to the SWF with Flash vars, then dynamically create an absolute path which gets stored in a static settings class upon initialization.

IE.

src="{GlobalSettings.ASSET_PATH}/my_img.png"


Does this work for your situation?


Best Regards,
~Aaron

Thank you for responding, however I don't think this works for my situation, I am not having trouble loading assets.

I am having trouble with BrowserManger.

For example the url "looks" like mydomain.com/mothers-rings/ So when I call IBrowserManager.init("myfragment"); I expect the url to change to mydomain.com/mother-rings/#myfragment but because I have a base tag set it goes to whatver the base tag is plus #myfragment eg: mydomain.com/mypage.com#myfragment

Well wait a second, I guess if I DON'T use a base tag, I can use your method for loading assets into the .swf but then I would still need a way to fix the assets I embed into the actually html page.

lol all this because I simply want to remove the .php at the end of my url lol there should be an easier way.:confused:

Peter Cowling
01-28-2009, 05:11 PM
Hi,

Can you not use the deeplinking approach to rewrite the URL. i.e. rewrite the browsermanager fragment, and do not use the apache mod aspect?

halfasleeps
01-29-2009, 02:08 PM
Hi,

Can you not use the deeplinking approach to rewrite the URL. i.e. rewrite the browsermanager fragment, and do not use the apache mod aspect?

Unfortunately no. Without apache when the user goes to domain.com/mothers-rings/ they wont have reach the page with the .swf they will be given a 404 instead, apache is what feeds the the correct page when they type in the prettier URL.

The real reason we even want to do this is for SEO.

Peter Cowling
01-29-2009, 03:39 PM
Sorry if I am missing something here, but I use this approach to re-write links without producing 404 errors.

You can use the approach to produce links for:


a specific viewstate
data specific links i.e. a view, displaying only specific sub-set of data


With regards to SEO, re-writing the link will not do a whole heck of a lot. Neither does that deeplinking approach that I talk about above.

The only thing I think does have any effect at all on things like google is the data-first XSLT approach. This approach at gets your data crawled.

halfasleeps
01-29-2009, 04:37 PM
Sorry if I am missing something here, but I use this approach to re-write links without producing 404 errors.

I thank you for your help but I do believe you are missing something.

If the real address of the page containing the .swf is located at:
mydomain.com/mothers_rings_flex.php
And a user types this address in their browser:
mydomain.com/mothers-rings/
And hits go...How on earth will they get to the correct location? (except for something like apache redirecting)

Peter Cowling
01-29-2009, 04:55 PM
You are correct. Thinking about it again, you can only re-write the fragment after the html or php address.