.htaccess 通过htaccess重写url以显示问号

.htaccess 通过htaccess重写url以显示问号,.htaccess,url-rewriting,.htaccess,Url Rewriting,我在以下url中有一个链接: Http://localhost/mydomain.com/?a=ax&b=bx&c=cx 我希望url如下所示: Http://localhost/mydomain.com/ax/bx/?c=cx 有什么想法吗?您可以在文档\u ROOT/.htaccess文件中使用此规则: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(\w+)/(\w+)/?$ /?a

我在以下url中有一个链接:

Http://localhost/mydomain.com/?a=ax&b=bx&c=cx
我希望url如下所示:

Http://localhost/mydomain.com/ax/bx/?c=cx

有什么想法吗?

您可以在
文档\u ROOT/.htaccess
文件中使用此规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)/(\w+)/?$ /?a=$1&b=$2 [L,QSA]
参考资料:

你试过什么吗?我试过:
RewriteRule^([a-zA-Z0-9\-]+)\([a-zA-Z0-9=]+)$index.php?a=$1&b=$2
但是,问号“?”没有显示:(你必须检查你的Apache的错误日志,因为这段代码对我来说运行得很好。我找到了以下代码:
RewriteRule^([a-z]+)/([a-z]+)$index.php?a=$1&b=$2&c=$3
Result:
localhost/mydomain.com/a/b/+c
我想将加号“+”改为“=”。但是,当我改为问号时,它不起作用。我希望:
localhost/mydomain.com/a/b/?c=cx
您必须关注问题中最初陈述的问题。此规则用于支持
http://localhost/mydomain.com/ax/bx/?c=cx
URL,我已经测试过了,效果很好。我不明白你的问题。当你输入
http://localhost/mydomain.com/ax/bx/?c=cx
URL在浏览器中?找不到对象!错误404为什么?