.htaccess是否替换url?
我有这样一个url:.htaccess是否替换url?,.htaccess,.htaccess,我有这样一个url: localhost/site/index.php?option=com_cust&tool=edit 我想将index.php?option=com\u cust&tool=edit替换为edit。这可能吗?我所做的尝试无效,例如: RewriteEngine On RewriteRule ^index.php?option=com_cust&tool=edit localhost/site/edit [L,QSA,R=301] 这是反向的——重写模块所
localhost/site/index.php?option=com_cust&tool=edit
我想将index.php?option=com\u cust&tool=edit
替换为edit
。这可能吗?我所做的尝试无效,例如:
RewriteEngine On
RewriteRule ^index.php?option=com_cust&tool=edit localhost/site/edit [L,QSA,R=301]
这是反向的——重写模块所做的是接收用户输入的内容(在本例中为“编辑”),并将其转换为服务器可以理解的内容(加载index.php并向其传递一系列变量)
此外,你肯定不需要外部重定向,更不用说301重定向了L'应该是您在此处需要的唯一标志。可能的重复:可能的重复:您可以阅读有关htaccess技巧和提示的内容,并找到一些非常有用的信息!嗨,谢谢你的帮助和解释。我应用了规则,但url仍然没有改变?我有选项+FollowSymlinks和RewriteEngine,所以我不知道它为什么不工作?没问题-你有所有的覆盖设置吗?尝试在.htaccess文件中插入一些随机字符,看看它是否会抛出500个错误。是的,我在我的httpd中设置了该错误,并且随机字符在站点上也会抛出500个错误。非常抱歉-我没有注意到URL的
站点
部分。我更新了我的答案,你现在可以检查吗?让它成为RewriteRule^(site)/(edit)/?$$1/index.php?option=com\u cust&tool=$2[L,NC,QSA]
RewriteRule ^site/edit site/index.php?option=com_cust&tool=edit [L]