The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
.htaccess not working with 'post' requests - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: .htaccess not working with 'post' requests (/showthread.php?tid=487)



.htaccess not working with 'post' requests - bitsoft - 03-05-2017

I'm using the .htaccess code below to hide .php in the url. It works fine, however all POST requests do not work afterwards. For example, all form submissions stopped working unless I changed them to GET.

Please help take a look why this is happening and a way out.


Quote:Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
# RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_URI}.php [L]



.htaccess not working with 'post' requests - mudmin - 03-05-2017

I think servers treat it as a security liability when you rewrite post data.

You could try...
Code:
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_METHOD} !POST




.htaccess not working with 'post' requests - bitsoft - 03-06-2017

Wow! Thanks, you saved my day. It works now.


.htaccess not working with 'post' requests - mudmin - 03-06-2017

That's awesome! Glad it worked!


.htaccess not working with 'post' requests - Kighlander - 03-10-2017

Hello.

I also love "clean" url...

Is it possible to post the complete .htaccess file here ?

Greetinxx,

Kigh


.htaccess not working with 'post' requests - bitsoft - 03-10-2017

Hi,

Sure! There you go

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
# RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_METHOD} !POST
RewriteRule ^ {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_FILENAME}.php -f [NC]
RewriteCond {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_METHOD} !POST
RewriteRule ^ {3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{REQUEST_URI}.php [L]



.htaccess not working with 'post' requests - mudmin - 03-10-2017

That actually works really well. Do you mind if we use that?



.htaccess not working with 'post' requests - Kighlander - 03-10-2017

I tried the .htaccess file but with facebook-login it doesn't work...


.htaccess not working with 'post' requests - mudmin - 03-10-2017

I wonder if you need to go back into your facebook configuration (on both facebook.com and userspice) and remove the php from your callback url.


.htaccess not working with 'post' requests - bitsoft - 03-11-2017

Absolutely, @mudmin
Feel free