我有这个code中的.htaccess文件,它工作得很好,因为它删除PHP文件extension.It也允许页面未扩展加载。
I have this code in HTACCESS file and it works fine as it remove .php file extension.It also allows page to load without extension.
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks -MultiViews
Options +SymLinksIfOwnerMatch -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
它的工作原理罚款。问题是,当我使用code
It works fine.The issue is when i use this code
<form action="test.php" method="post" id="myform" name="myform">
<input type="text" name="username">
<input type="submit" value="login">
</form>
在test.php的回声$ _REQUEST [用户名];
是空/空
On test.php echo $_REQUEST['username'];
is empty/null.
我试图从表单操作删除的.php然后worked.But我不能在网站上使用的所有文件删除的.php。
I tried to remove .php from form action then it worked.But i can not remove .php from all files used in website.
有关重复的标记:我读这post但我的问题是different.With我,形式submites但不携带价值。
For Duplicate markers:I read this post but my question is different.With me,form submites but carrying no values.
插入此规则仅低于的RewriteBase
行来避免重定向POST请求:
Insert this rule just below RewriteBase
line to avoid redirecting POST requests:
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^ - [L]