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

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题