简体   繁体   English

htaccess RewriteCond和RewriteRule

[英]htaccess RewriteCond & RewriteRule

I've pulled most of whatever was left of my hair out on this one, and my feeling is that the answer is quite simple. 我已经把头发上剩下的大部分东西都拔掉了,我的感觉是答案很简单。

I have a URL: 我有一个网址:

https://www.example.com/?download= {rest of query string here} https://www.example.com/?download= {此处其余查询字符串}

and I want to rewrite that into 我想将其重写为

https://www.example.com/index.php?download= {rest of query string here} https://www.example.com/index.php?download= {此处其余查询字符串}

The user doesn't need to be redirected. 用户不需要重定向。 But I cannot figure this out. 但我无法弄清楚。 I tried 50 or 60 different things and I'm hoping someone can help. 我尝试了50或60种不同的方法,希望有人能提供帮助。

Have you tried simply: 您是否尝试过简单:

DirectoryIndex index.php

In the htaccess file in your document root? 在您的文档根目录下的htaccess文件中?

Or try: 或尝试:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^download=
RewriteRule ^$ /index.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM