Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php项目中使用.htaccess解决页面链接_Php_.htaccess - Fatal编程技术网

如何在php项目中使用.htaccess解决页面链接

如何在php项目中使用.htaccess解决页面链接,php,.htaccess,Php,.htaccess,目前,我正在从事一个php项目,我想使用.htaccess清理我的URL,下面的代码包含在我的.htaccess文件中: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php RewriteRule printQuotation/(.*)/ printQuotation.php?quotation_no=$1 Re

目前,我正在从事一个php项目,我想使用.htaccess清理我的URL,下面的代码包含在我的.htaccess文件中:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule printQuotation/(.*)/ printQuotation.php?quotation_no=$1
RewriteRule printQuotation/(.*) printQuotation.php?quotation_no=$1
RewriteRule printInvoice/(.*)/ printInvoice.php?invoice_no=$1
RewriteRule printInvoice/(.*) printInvoice.php?invoice_no=$1

ErrorDocument 404 http://localhost/swift/main/404
它可以正常工作,但当我想在打印页面打印发票或报价时,它会返回如下输出:

<?php
$quotation_ no = $_GET["quotation_no"];
echo $quotation_no;

前面的代码使用所有php文件中的remove.php扩展请任何人在此问题上帮助我您可能应该按相反的顺序执行此操作(首先检查您的特定PrintQuotence/printInvoice模式),并使用L标志防止进一步重写。另外,不要显示“输出”没有说什么输入导致它在第一位。提及您请求的URL!localhost/swift/main/printquote/1938213