dongpo8250 2019-07-12 20:20
浏览 105
已采纳

Url使用发布数据在LAMP服务器上重写

Im trying to set up a URL rewrite rule set on my LAMP server and all GET request are working as they should, but as soon as i submit a posted form all post-data disappears. If i change the form to GET then i get everything (within the limitations of the URL length).

To keep a clean URL i would really prefer to user the URL rewrite options instead of a long ugly URL ;-)

My .htaccess file looks like this (made from googled results):

RewriteEngine On                                                                                     # Turn on the rewriting engine
RewriteRule    ^admin/module/([A-Za-z0-9-_]+)?$      admin.php?page=module&mod=$1    [NC,QSA,L]      # Process admin requests
RewriteRule    ^admin/([A-Za-z0-9-_]+)?$             admin.php?page=$1               [NC,QSA,L]      # Process admin requests
RewriteRule    ^admin/?$                             admin.php                       [NC,QSA,L]      # Process admin requests
RewriteRule    ^/?$                                  index.php                       [NC,QSA,L]      # Handle all requests

I have tried to change the [NC,QSA,L] part by removing the QSA and / or the NC part with no luck

My HTML form tag looks like this:

<form action="/admin/setup" enctype="text/plain" method="post" >

I have tried to google the problem with no result... no result that made any sense anyway, so please let me know if you need any more info from me.

URL rewriting is still somewhat new to me so please give some explanation to you answers

Thanks in advance :-)

---- EDIT 2019-07-12 ----

Linux Version is:

Linux X-gene 4.9.0-9-arm64 #1 SMP Debian 4.9.168-1 (2019-04-12) aarch64 GNU/Linux

PHP version is:

PHP 7.0.33-0+deb9u3 (cli) (built: Mar 8 2019 10:01:24) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33-0+deb9u3, Copyright (c) 1999-2017, by Zend Technologies

Apache version is:

Server version: Apache/2.4.25 (Debian)

Server built: 2019-04-02T19:05:13

...with these loaded modules (PHPinfo):

core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter util_ldap mod_mime prefork mod_negotiation mod_php7 mod_proxy mod_proxy_connect mod_proxy_html mod_proxy_http mod_reqtimeout mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_xml2enc

  • 写回答

1条回答 默认 最新

  • dongmei2351 2019-07-22 20:55
    关注

    Allow me to admit to answer this with a [face_palm] + DOH!

    I did rewrite the code not to use the url rewrite, but got the same result anyway. Then i looked into the enctype of the from and found out that the default enctype should be

    application/x-www-form-urlencoded

    and NOT

    text/plain

    as in the question, and as soon as i inserted the new enctype there was no problem.

    I am not going to change the code back to use url rewrite but again... allow me to admit a stupid error and say thanks to all of you who might have been trying to look into it to find a solution

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题