Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite and flash - unexpected problem

         

wide_circle

9:10 am on May 5, 2007 (gmt 0)

10+ Year Member



Hello there!
I try to make flashsites indexible by search engines. What I do is I use a combination of a flashplugin called tablemaker (www.flashrelief.com) which renders xhtml tables to flash (awesome timesaver for complex layouts) and mod_rewrite. I use mod_rewrite to redirect users to the flashpages and feed the searchengine bots the html pages that also becomes the content in flash. I do this with the help of setting up a rewrite condition involving user agent. The problem though is that when the .htaccess is present with it's redirects the html isn't beeing rendered to flash. It seems that redirection also takes place when the flash plugin is trying to fetch and render the html-tables to flash.
Now to my question: Does anyone now if there is a way to write some sort of rewrite condition so that somehow flash still can get access to the html without redirection. This would be awesome if it would work! I'm not quite sure how the plugin is communicating with the html and I have sent a support e-mail to flashrelief to try to figure that out...

All the best, Niklas

jdMorgan

2:45 pm on May 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you need to know how the back-end works before you can address the problem.

But bear in mind that basing your Rewrite upon the HTTP user-agent requires a lot of care; Many plugins do not send a unique HTTP User-agent string in their requests. Many users have "Internet Security" software that blocks the HTTP User-agent and the HTTP Referer headers -- and they may not even be aware of this. And users behind corporate or ISP caching proxies such as all AOL users, make their requests through those proxies, and the proxy will not pass every request to your server -- and if it does, then those HTTP headers may be missing or modified.

About all you can count on is that in most cases, the search engine spiders *will* provide a proper HTTP User-agent string, unless they are cloaking to check out your site as a human visitor would see it. But when dealing with human visitors, their browser plugins, their company or ISP proxies, and their security software, you really can't count on anything to be 100% reliable.

Be aware that in order to 'steer' requests to different files (or scripts), an external HTTP redirect is not needed. Nor is it recommended. Instead, a server-internal rewrite should be used. The same is true for this "plugin" you're using: It should not be making HTTP requests for files on the server when it could simply access the files in the local filesystem directly. Look and see if there is a configuration option for this; If all files that it needs are local, there is no reason to use HTTP requests to get them -- It's hundreds to thousands of times slower.

Jim

wide_circle

4:51 pm on May 5, 2007 (gmt 0)

10+ Year Member



Jim!

Thanks for getting back to me so fast!
Well - some of the things your talking about seems to be a little over my head but extremely interesting! :)
All the redirects are handlng files that are located on the same server. How do I make and use "server-internal rewrites"?
Here is the .htaccess file that I have so far (it could probably be written in a better format - I'm just not hundred percent sure just yet of what I'm doing here since .htacess is new to me):

# Enables mod_rewrite
RewriteEngine on

# Sets the base folder
RewriteBase /

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

# Redirects
RewriteRule ^home\.html$ index.html [R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^home_en\.html$ index_en.html [R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^jobb_webb\.php$ #/portfolio [R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^jobb_tryck\.php$ #/portfolio [R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^jobb_diverse\.php$ #/portfolio[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^portfolio_web\.php$ index_en.html#/portfolio[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^portfolio_print\.php$ index_en.html#/portfolio[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^portfolio_misc\.php$ index_en.html#/portfolio[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^om_mig\.html$ #/om%20mig[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^about\.html$ index_en.html#/about%20me[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^service\.html$ #/service[R,NE,L]

#Redirects only when visiting with browsers
RewriteCond %{HTTP_USER_AGENT} !Googlebot¦Msnbot¦Slurp¦Jeeves [NC]

RewriteRule ^service_en\.html$ index_en.html#/services[R,NE,L]

jdMorgan

3:01 am on May 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops...

Because you are using "named anchors" (URLs containing "#anchor") you will have to use a redirect.
All I can do is give you a way to avoid the blank user-agent problem and to shorten your code at the same time:


# Enable mod_rewrite
RewriteEngine on
#
# Set the base folder
RewriteBase /
#
# Skip all subsequent rules if major search engine robot or if blank user-agent
RewriteCond %{HTTP_USER_AGENT} Googlebot¦Msnbot¦Slurp¦Teoma¦^$ [NC]
RewriteRule .* - [L]
#
# Redirects
RewriteRule ^home\.html$ index.html [R,L]
RewriteRule ^home_en\.html$ index_en.html [R,L]
RewriteRule ^jobb_webb\.php$ #/portfolio [R,NE,L]
RewriteRule ^jobb_tryck\.php$ #/portfolio [R,NE,L]
RewriteRule ^jobb_diverse\.php$ #/portfolio[R,NE,L]
RewriteRule ^portfolio_web\.php$ index_en.html#/portfolio [R,NE,L]
RewriteRule ^portfolio_print\.php$ index_en.html#/portfolio [R,NE,L]
RewriteRule ^portfolio_misc\.php$ index_en.html#/portfolio [R,NE,L]
RewriteRule ^om_mig\.html$ #/om%20mig [R,NE,L]
RewriteRule ^about\.html$ index_en.html#/about%20me [R,NE,L]
RewriteRule ^service\.html$ #/service [R,NE,L]
RewriteRule ^service_en\.html$ index_en.html#/services [R,NE,L]

I also suggest that for redirects, you specify a canonical URL substitution. For example:

RewriteRule ^jobb_webb\.php$ [b]http://www.example.co.uk/[/b]#/portfolio [R,NE,L]

Note also that Ask.com has dropped the "Jeeves" from their name, and that their robot is now known as "Teoma".
"Jeeves" still works, but it remains to be seen how strongly their "marketing and branding" department affects their engineering department's legacy support for the "Jeeves" user-agent string... Best bet is to update the user-agent string in case they drop support for "Jeeves".

Jim

[edited by: jdMorgan at 3:03 am (utc) on May 6, 2007]

wide_circle

12:57 pm on May 6, 2007 (gmt 0)

10+ Year Member



Oh - wow!

Thanks alot for your help!
I'm still not sure about the plugin and how it communicates between flash and html but I suspect javascript...

Will get back as soon as I know more...

Niklas

wide_circle

9:49 am on May 9, 2007 (gmt 0)

10+ Year Member



I found out that the communication is handled thru the xml object in flash. [livedocs.adobe.com...]
I don't now of a way to solve this - this is all actionscript.
Don't know if there is a way write something in the .htaccess file that will have an impact on this.
Maybe this is something close to it but since I'm using a plugin I won't be able to change anything in the actionscript code but rather it needs to be done in the .htaccess
[tutorials.lastashero.com...]

Niklas

wide_circle

12:39 pm on May 10, 2007 (gmt 0)

10+ Year Member



Hmmm...your shortened code doesn't work - the redirects doesn't redirect...

wide_circle

12:48 pm on May 10, 2007 (gmt 0)

10+ Year Member



Acually - forget last statement. It does work..