Apache Rewrite solution to the presence of the bad Request

Source: Internet
Author: User

<virtualhost *:80 *:81>
ServerAdmin [email protected]
Documentroot/active/www/yingchao123/trade
ServerName trade.test.yingchao123.com
Serveralias trade.yingchao123.com

Rewriteengine on
Rewriterule ^ ([\da-z]{1,10}) $./index.php?mod=list&do=unique&alias=$1 [L]
Rewriterule ^ ([\da-z]{1,10}) & (. +) $./index.php?mod=list&do=unique&alias=$1&$2 [L]
</VirtualHost>

But there's a bad Request error when you write this.

The workaround is to write the rewrite rule down in directory:

<virtualhost *:80 *:81>
ServerAdmin[email protected]
Documentroot/active/www/yingchao123/trade
ServerName trade.test.yingchao123.com
Serveralias trade.yingchao123.com

<directory "/active/www/yingchao123/trade" >
Rewriteengine on
Rewriterule ^ ([\da-z]{1,10}) $./index.php?mod=list&do=unique&alias=$1 [L]
Rewriterule ^ ([\da-z]{1,10}) & (. +) $./index.php?mod=list&do=unique&alias=$1&$2 [L]
</Directory>
</VirtualHost>

Restart Apache, problem solving

Description: Apache checks whether the configuration is syntactically incorrect httpd.exe-t or apachectl-t,nginx the corresponding command is NGINX-T

Apache Rewrite solution to the presence of the bad Request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.