在apache中,如何重写“.name”到“../ajax/name.php”
将所有 ajax 放在 ../ajax
目录中,并且所有以点开头的 xmlRequest
url,例如,
http://company.com/.call?arg=val
将被重写为
../call.php?arg=val
使用 php 中的处理程序来完成这项工作,但会更简单地使用 apache
mod rewrite.load
启用
have all ajax in ../ajax
directory and all xmlRequest
urls starting with a dot, eg,
http://company.com/.call?arg=val
would be rewritten as
../call.php?arg=val
was using handler in php to do the job, but would much rather simply use apache
mod rewrite.load
enabled
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您与要重写为其他内容的文件路径不太一致。我假设您有一个文件 call.php,位于“ajax”文件夹 (domain.com/ajax/call.php) 中,并且您希望使用 domain.com/.call 调用该文件
假设您有激活重写引擎,并知道在哪里放置重写规则,您想要的适当的重写规则如下所示:
这会重写以“.”为前缀的任何内容。到 ajax-folder 并添加后缀“.php”。此外,论据完好无损。
You are not quite consistent with what file path you want rewritten to something else. I am going to assume that you have a file, call.php, located in the "ajax" folder (domain.com/ajax/call.php) and you want this to be called with domain.com/.call
Assuming you have activated the rewrite engine, and know where to put rewrite rules, the appropriate rewrite rule for what you want would look like this:
This rewrites anything prefixed with a "." to the ajax-folder and suffixes it with ".php". Additionally, arguments are intact.