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

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

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来