Search

I just worked on this problem for over an hour so I thought I’d share.

If your POST variables are just disappearing, it may be a simple fix..

I was testing

<form method="post" action="pool/new" enctype="multipart/form-data">

and my data was disappearing, use

<form method="post" action="pool/new/" enctype="multipart/form-data">

the trailing slash is all that’s needed. It is SUPER important. It should be stressed in the tutorials and events section, but no worries, hope this helps!

Just as a note, this is caused by a limitation of the URL rewriting process: all links to pool/new will be redirected to pool/new/ automatically (which is an intended behaviour). Sadly, automatic redirection cannot “forward” POST requests.

So this is definitely something that should be added to the documentation.

FALSE :)

This should be written into symphony http://see.weareinto.com/3oid

It’s not false at all, Nils explanation is correct. It is a limitation of the rewrite process, served by mod_rewrite module

The link above is a fix, and a very crafty htaccess voodoo fix, however it pushes the rewrite request through the mod_proxy module instead of mod_rewrite.

It could be added into the htaccess file for Symphony installs, but what would happen if mod_proxy and mod_http_proxy weren’t installed? The P (Proxy) flag acts the same as the L (Last) flag in htaccess, but does it fall-back gracefully to L if the module is missing? I dunno myself…

Testing it seems to break it without the proxy modules installed, so I think this should remain a custom hack rather than a default setup.

Change

### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/?)$ index.php?symphony-page=$1&%{QUERY_STRING}    [L]

To

### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/?)$ /index.php?symphony-page=$1&%{QUERY_STRING}   [P]

Not forgetting the prepended slash to the index.php statement. Forgetting that will cause an infinite loop.

Ha! okay great. I was just being hopeful :P

Thanks @designermonkey and @Nils

Did you get it working?

@designermonkey No, .htaccess eludes me, played with it a bit to no avail.

If Symphony enforces the fact that URLs end in a trailing slash, isn’t the solution to abide by this rule rather than try to forward on POST vars when not abiding by it?

I would have thought so, yes…

Those Symphony rewrite rules certainly doesn’t redirect to a URL with trailing slash. Does Symphony do this later in the PHP processing of the request?

There’s an Apache module (mod_dir) which does this automatic redirection when no file matches the current request, you could try adding this to the top of your .htaccess to prevent this:

DirectorySlash Off

@nickdunn if it was a matter of changing a line in an htaccess file to prevent this hard to target error, I think it’s great. Especially because it isn’t a full break, the page still shows, just doesn’t carry the POST : - IMHO a full break would be nice.

@froded, do you mean the ones I posted? Or the ones in the htaccess file?

You’ve made me realise something I missed though:

### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

Change to

### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [P,R=301]

This is the section of the htaccess that does the rewrite to a slash

@designermonkey: Ah, sorry, I was apparently too lazy to check the actual .htaccess file myself and assumed what you posted was the relevant section. I only commented on the lines you posted.

Haven’t looked too closely at Symphony’s .htaccess file before. But I must say I’m a bit unsure if forcing a trailing slash on every request should be done. Loosing POST data is one possible problem. But a trailing slash symbolizes to me a directory/catalog which does not fit with “URL for an article/product/photo/any-singular-item”. I’m wondering what the reason is for doing this, and what other “problem” it solves?

Loosing POST data is one possible problem

But if you add the trailing slash to your form action attributes, then it doesn’t become a problem ;-)

I don’t think the trailing slash attempts to solve any specific problem, but it was a preference and a convention that was adopted.

More reading: Trailing slash rule in .htaccess

uff, after 5 hours I finally found this page which helped immediately! :D Thank you very much :D

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details