TinyMCE / Tinybrowser upload tab giving a 404 - php

Just looking for a bit of help with Tinybrowser - I've tried updating it to the latest version but it's still failing. If I click the 'Upload' tab I get a 404.. I'm thinking it's possibly to do with the htaccess, but I'm not too hot with htaccess rules so I can't pinpoint it.
If I visit the page directly (/admin/javascript/tiny_mce/plugins/tinybrowser/upload.php?type=image&tokenget=315af6ee7cf85bc6170760a0c1a5b86d&folder=) I get a 404 as well. If I take off 'folder=' it'll go to the page, if I make it follllder=, it'll go to the page. So for some reason 'folder=' seems to be causing problems. Even if I manually put in a string for the folder var.
The htaccess is as follows:
# default
Options All -Indexes
RewriteEngine On
RewriteBase /
# Make sure there's no way of getting to this file
<FilesMatch "\.htaccess$">
Order deny,allow
Deny from all
Satisfy all
</FilesMatch>
RewriteRule ^login(/*)$ system/login/ [L,QSA]
# Route all other traffic to index.php (front controller)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?_args=$1 [L,QSA]
AddType text/x-component htc
If I remove
RewriteRule ^(.*)$ /index.php?_args=$1 [L,QSA]
I end up getting a 403 forbidden error, but obviously it's not really feasible to remove this line anyway.
Thanks in advance guys

I just ran into this as well.
The problem appears to be a security restriction on some servers that relates to the filename of the PHP file, as well as the "folder=" querystring.
I got around it by renaming upload.php to upload_tab.php, and then modifying tinybrowser.php to reference the upload_tab.php file:
if($tinybrowser['allowupload'])
{
?><li id="upload_tab"><span><?php echo TB_UPLOAD; ?></span></li><?php
}
This allows you to see the upload window, and submit some files using POST variables.
However, a problem remains...
The particular server I came across also has a similar restriction on a request to upload_file.php with a querystring of 'folder='. There isn't an easy fix for this, apart from decompiling flexupload.swf (which I tried, but couldn't recompile it) so I couldn't fully resolve the issue.

Related

On local works, on server shows 404

I need help with something I don't understand.
I am developing a website for a customer.
I am doing on local, and every day upload to the server all changes and new things.
Last I done is create a simple way to extract the section, parameters and values from url. Is something like:
http://mywebsite.com/product/color/red
Really is not a shop, but this example shows clearly I want to tell you.
The idea is that I have a folder with the sections (product.php, home.php, contact.php, ...) and the section on url says the file to use.
This is working on my computer.
But now I've uploaded all files (literally) to server and not is working.
Shows me a 404 error.
I think the problem is into .htaccess and the PHP versions (I works on php 5.5.10 on local, and server runs on 5.4.16).
This is .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?params=$1 [QSA,L]
</IfModule>
I don't know if you need something more information about all this. If you want, say it and I show you.
I hope you can help me.
Thank you!
UPDATE 2015 July 02
I tried a lot of thing and none worked.
Finally I tried to redirect to google, but not works. And I tried even break it with some wrong code into .htacces, but neither.
Searching I've read that the problem is AllowOverride is none.
For this I tried:
<Directory "/var/www/sites-public/laceart.cadt.com/html/">
AllowOverride All
Allow from All
</Directory>
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html http://www.google.com/? [R=301,L]
Still not working. But I don't know if Document Root is correct.
Can someone to help me?

Can't redirect with .htaccess

On the end of my rope here, nothing that should be working is.
I'm new to website building and I noticed my visitors were trying to access certain pages and getting forbidden warnings e.g.: trying www.test.com/test you give a 403 error.
All I want to do is make it so www.test.com/test would redirect it to a test.html file in a directory right above it.
Tried doing it with .htaccess in the root directory with nothing but
redirect /test www.test.com/test.html
Doesn't work. Just gives me the 403 error.
Tried a simple index.html file to redirect with nothing but
<?php
header('Location: www.test.com/test.html');
die();
?>
But that doesn't work either.
Really not sure why both of these outright refuse to work.
header parameter should be wrapped in double quotes. like
header("Location: www.test.com/test.html");
exit();
also make sure your server recognizes your file extention as a php file if its not having a .php file extension. You can add the custom extensions by editing httpd.conf.
If I am interpreting correctly your ultimate intention, you don't need to use redirections, just try this in your .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ $1.html [QSA,L]
</IfModule>
This way, every requested URL will be interpreted as if it was the same request plus .html.
Although you could do it via a redirection, it is not necessary.
So once you have that code in your .htaccess you just need to have the file test.html in your root, and www.test.com/test will serve the www.test.com/test.html page.

Trying to figure out htaccess issues

I'm having some issues figuring out how to use an htaccess file. I've got apache/php installed on an ubuntu system and mod_rewrite is turned on (php_info() states that it's in the list of loaded modules). The web server works, displays html and php files, so I'm happy with that.
What I'm trying to figure out now is how to use an htaccess file properly. I created a directory, /data, with an index.php file in it. All I want it to do at the moment is just display the $_REQUEST variable so I can see if things are working the way I assume they should.
Example: If I type in the following URL: localhost/data/info1/ I want the htaccess file to access localhost/data/index.php?request=info1
However, no matter what I enter in to the htaccess file, I keep getting 404 errors, and I'd like to understand why.
Here's my htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule data/(.*)$ data/index.php?request=$1 [L]
</IfModule>
I've made no changes to the config file, to activate mod_rewrite, I used the ubuntu a2enmod command so ubuntu did it for me. After that, I restarted apache.
What I can't figure out is why this doesn't work. My assumption is that there's still some sort of configuration I need to do on the server end, but I honestly don't know what. Is there any advice anyone can offer me?
Here's the fix:
RewriteRule ^data/(.*)$ data/index.php?request=$1 [L]
(You were missing a ^)
EDIT:
In the OP, you have another leading / in the URL example, in this case it'd be:
RewriteRule ^data/(.*)/$ data/index.php?request=$1 [L]

need to change htaccess rewrite code

I have just had a problem with a Codeigniter site where, after the hosting company had migrated files to a new server, I could no longer navigate away from the home page. I Googled a forum with a similar issue and the answer was my htacess file. It was previously like this:
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
and the given solution was to add a '?' character after 'index.php'. I did that and everything then worked OK.
I have tried hard to understand htaccess code and syntax and read many documents but they might as well be written in Chinese for all the sense I can get out of them. So can anyone explain why that additional '?' was needed and what it did? And if you can explain the rest of the code too I would be eternally grateful!
Your new host's php handler or webserver isn't setup to handle PATH INFO, or the stuff after the script (index.php) that's part of the actual path, e.g.
/index.php/this/is/part/of/the/path_info
The index.php script is executed, and everything after can be fetched via "PATH_INFO". If the server doesn't handle this, code igniter can optionally handle the path passed in as the QUERY STRING. Which are parameters that follow a ?.
None of this has anything to do with htaccess or mod_rewrite. It's just the way URLs and handlers work.

Forms are broken in CodeIgniter

I am trying to rewrite my urls to go from /controller/method to index.php?/controller/method, and that is mostly working, except that forms won't submit correctly. I have some routing set up, but the forms are also breaking on non re-routed urls. Here's a little context.
I have moved my index.php out into a separate web folder that is the web root, so there is no chance of exposing application files. I'm not sure whether this would potentially cause this problem, but it's something slightly unusual about my installation. My directory structure looks like:
+ codeigniter/
+ application/
- models, views, etc
+ system/
+ web/
- .htaccess
- index.php
- css, javascript, images, etc
My .htaccess is pretty simple:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
It seems to work fine on XAMPP for Windows, but it is broken on a basic Ubuntu LAMP stack. When I submit a form, nothing happens. The page that the form directs to loads, but as if the form hadn't been submitted.
Sorry, one more important piece of information: If I leave the index.php in there, so the urls look like /index.php/contacts/edit/1, it works.
Let me know if I can provide any more information. Thanks!
Turns out a part of the .htaccess that I didn't include was causing the error to be difficult to find.
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
I had assumed that this would show a CodeIgniter error page if it reached that block, but it turns out (I assume) that CodeIgniter was valiantly trying to salvage the situation by looking at the path in $_SERVER, from which it was able to get the page it was supposed to display. However, since the path didn't exist, none of the $_POST data made it through. In the error log I was seeing this line:
[error] File does not exist: /path/to/web/contacts/edit/1
Enabling mod_rewrite solved the problem.

Categories