The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess not working with 'post' requests
#1
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]
  Reply
#2
I think servers treat it as a security liability when you rewrite post data.

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

  Reply
#3
Wow! Thanks, you saved my day. It works now.
  Reply
#4
That's awesome! Glad it worked!
  Reply
#5
Hello.

I also love "clean" url...

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

Greetinxx,

Kigh
  Reply
#6
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]
  Reply
#7
That actually works really well. Do you mind if we use that?
  Reply
#8
I tried the .htaccess file but with facebook-login it doesn't work...
  Reply
#9
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.
  Reply
#10
Absolutely, @mudmin
Feel free
  Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)