SWF works locally but not loaded from server - mod-rewrite

Here is the deal. I have SWF build with Unity and embedded into HTML page with swfobject. It works perfectly well when I load page locally (zip), but it always says "Movie not loaded" when I try to load page. from server
I have already inspect similar embedded movies (this one, and this one) and found no differences in HTML code neither in scripts. So I suspect the source of problem is my server, most likely its rewrite rules. Yesterday I tried to understand the meaning of this file using multiple manuals, forum threads et cetera:
AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Once upon a time, before Google Translate even exists, I have spent a whole day to succesfully translate an article from simplified Chinese to Russian (with zero experience in Chinese and overall C- for school course of Russian). So it was surprisingly frustrating to me when I have spent same period of time to a few strings of declarative code and still have no idea even if am I right and it will solve my problem.
So I will gratefully appreciate a helpful answer or two.

I did some further tests, sadly there are no errors on the console. But it pretty much looks like there's something wrong with your .swf file on the server, because when I download the file from your server it is not working locally either. (Did you try that before?)
How did you upload the file? There are many sources on the web (e.g. http://www.techtutorials.net/articles/ftp_binary_or_ascii__a.html) that point out that you must use binary mode for files like .swf.
=> Upload the file again using binary mode
Some other thoughts:
Check the file permission of the .swf file, should have at least read rights (e.g. 644)
Check for the mime type in Apache: AddType application/x-shockwave-flash swf
Source: http://www.htaccess-guide.com/adding-mime-types/
Let me know if all of this doesn't solve your problem.

Related

ReWriteCond in .htaccess not working in IE11

The purpose of this code is to prevent people from accessing a pdf file unless they are accessing the file from another page in https://www.example.com. If they are trying to access the PDF from another site, they are to be redirected to our commercial website https://example2.com. (It is to prevent people who don't have authorized access from downloading a PDF or from copying the URL for the PDF and sharing it with others.)
RewriteEngine On
RewriteCond %{HTTP_HOST}##%{HTTP_REFERER} !^([^#]*)##https?://\1/.*
RewriteRule ^(.*) https://example2.com/ [L,R=301]
The code above worked fine with all browsers until a recent update to IE11 and now it ignores the rewrite condition and always redirects to https://example2.com even if you are linking from https://www.example.com. However it works as it should in Chrome and Edge.
I tried changing the rewrite to what I have below as I am fine hardcoding the URL, but got the same results:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https://www.example.com/.*
RewriteRule ^(.*) https://example.com/ [L,R=301]
How do I get this needed functionality to work in IE?
Maybe IE has an old and wrong rewrite rule cached. You could clear cache in IE and try again.
Besides, you could test your rewrite rules in this site. I test with your first code and it says:
This test string is not supported: %{HTTP_HOST}##%{HTTP_REFERER}
I test with your second code and it works. So I think you could clear IE cache and try again with the second code.
For more information, you could refer to this similar thread.

why do img tags dissappear in a mobile browser but not on a full browser

I am using a bootstrap theme called flatty. My site runs great on a full featured browser like on a desktop or laptop , but when i pull it up on a tablet or smart phone all the imgs load for 2 or 3 secs, then disappear.
I'm at a bit of a loss to know what to even look for. Any help would be appreciated.
Jan 27th: Update
So I finally got back to this issue. I discovered if I comment out the following lines of code in my .htaccess file, my pictures start working on the mobile browsers.
#RewriteEngine on
# if directory or file exists, ignore
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /vanity.php?s=$1 [L]
I was using this to set up vanity url's. I am not very good at all with this file. Anyone have any suggestions on how to correct this so my vanity url's still work?

Migrating a CodeIgniter site to a different domain and moving the whole thing down one level in directory

I am working on a site, which is built with CodeIgniter.
I have never used the framework before...I've learnt a little bit in the last couple days but really cannot solve my problem.
I have downloaded the site and I want to upload it to my own domain so not to make changes to the live site before testing.
the original site is example.com.
I want to upload it to mysites.com/examplesite (this will be the base - I use this domain for all my clients' test sites).
I have moved all the files and the database is in place.
I have found the database configuration file and have successfully edited it.
I am having trouble getting the site to work, I think it must be because of the site now being down a directory level.
I have edited $config['base_url'] so that it is correct...I am pretty sure it is correct because I can now reach the homepage where I couldn't before editing that variable. But, i can only reach the homepage - when I click on a link to another page, I get 500 error Internal server error.
Does anyone have a quick fix for me?
Thanks!
Keep this code on your project's root .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /examplesite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

.htaccess image to web page redirect of sorts

I think this can be done, though not sure, so I came here to find out from you experts. I researched extensively, but always get the opposite of what I want to do. I was wondering if someone types in the image file URL (on server side) into an address bar if that could be directed to its corresponding web page.
For example:
One types in yourdomain.com/wp-content/uploads/image-name.jpg and it's directed to yourdomain.com/print/image-name (w/o .jpg)
So instead of one just seeing the image in a window, they will see the image, it's information and how to purchase it on my brand web site.
If that is not possible or the file name doesn't match, can directly typed server side image file URLs redirect to my website galleries or home page? And where in .htaccess would this code be located? Above begin wordpress or not?
If above Begin WP, will that interfere with this code that already exists? If so how would I exactly write it?
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.sitename.com/$1 [R,L]
Thanks in advance!
EDIT: To clarify, my site being down has nothing to do with the help I received here. I upgraded my web host account and there was a glitch when they migrated it.
Insert this rule just below RewriteEngine On line:
RewriteCond %{THE_REQUEST} /wp-content/uploads/(.+?)\.jpg [NC]
RewriteRule ^ /print/%1? [L,R=302,NE]

How to keep mod_rewrite from recognizing directories

So, lately I've been dealing with an issue relating to mod_rewrite and it seems nobody is trying to do anything like it. Every question people have is about trying to exclude directories from the rewrite, when I want them to be included like any other.
For instance, assuming my root directory with .htaccess file in it is www.example.com/root/
When I type in made up directory, such as www.example.com/root/asdfasdf, I have my .htaccess file set to redirect me to www.example.com/root/index.php?url=asdfasdf without change what's in the address bar on my browser
However, in trying to do the same with a real directory, such as www.example.com/root/admin, it not only changes the url in the address bar but changes it to www.example.com/root/admin/?url=admin.
Can anyone explain to me what's going on. I've tried all kinds of different regular expressions and flags and the ones that redirect anything still cause this same issue. can I go to www.example.com/root/admin and still get redirected to the root folder while hiding that the query string is ?url=admin.
[UPDATE: additional information 11-30-2012]
Like I said, I've tried it will multiple different lines of code and come out with the exact same redirect issue, assuming the redirect doesn't just fail altogether and produce a 500 error. Here's one of my latest iterations, though, which has produced the issue of not ignoring direcotories.
RewriteEngine On
RewriteBase /root/
RewriteCond %{REQUEST_FILENAME} !^(.\*\\.("png"|"jpg"|"gif") [NC]
RewriteRule (.\*?) index.php?url=$1 [QSA]
The rewrite condition is to keep the engine from rewriting if a picture is being requested (for css and img tags). I only didn't mention it previously because I have tried removing that line and it has made no difference.
I'm not exactly a master of mod_rewrite, though, so if you see any errors with anything I've written, please feel free to let me know.
It's not entirely clear from your question what you are trying to do and it would have been helpful to see what your .htaccess file actually looked like. However the following lines in an .htaccess file in the root folder:
RewriteCond %{REQUEST_URI} !^/root/index\.php
RewriteRule (.*) /root/index.php?url=$1 [L]
Will silently redirect requests made to http://www.example.com/root/madeupfolder/madeupfile.php to http://www.example.com/root/index.php?url=madeupfolder/madeupfile.php and will also do the same for real folders. So if the folder admin exists under root, then requests to http://www.example.com/root/admin will be silently redirected to http://www.example.com/root/index.php?url=admin
If however you wanted to serve up folders and files that actually exist, but rewrite requests for folders and files that do not exist, then you would need to adjust the rewrite like so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/root/index\.php
RewriteRule (.*) /root/index.php?url=$1 [R=301]
This would still rewrite requests made to http://www.example.com/root/madeupfolder/madeupfile.php to http://www.example.com/root/index.php?url=madeupfolder/madeupfile.php, but for real folders and files, such as requests made to http://www.example.com/root/admin, the admin folder would be served up.
Hope this helps, but if you can clarify your question a bit then I can try and help again.

Resources