问题标签 [rewrite]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
7903 浏览

php - 如何确定 URL 是否在 PHP 中重定向?

我看到有人问一个关于检测 URL 是否从 groovy 和 perl 重定向但在 PHP 上找不到任何东西的问题。

任何人都知道我可以在某个地方找到执行此操作的代码吗?

0 投票
8 回答
377 浏览

sql - 您将如何编写此查询?

我希望将以下查询重构为更具可读性和可修改性的内容。前半部分与后半部分相同,但查询的数据库除外(但表名相同。)

这个查询是DRY的定义,并要求我重写,但我不知道怎么写!

编辑:我们不能使用 linq,我们希望得到不同的结果;我希望使查询的物理文件大小更小,而不是返回的结果。

编辑:我要查询的数据库是专有的 ERP 数据库。重组它不是一种选择。

0 投票
3 回答
1442 浏览

vb.net - Seemingly random crashes with VB.NET and COM Interop

I'm thinking of rewriting a brand new VB.NET application in VB 6.

The application runs under terminal services and makes heavy use of COM.

For some reason, there is random weirdness with the application -

  • Random Access Violation errors (WinDbg exception analysis points into dll's like comdlg32.dll, mscorwks)
  • Random Buffer Overflow errors (same)
  • Random errors in general - for example this line in Form.Load sometimes throws - Me.Icon = Resources.MyIcon

I have followed all possible advice concerning resources, garbage collection, disposal patterns, etc... It just doesn't seem to do any good.

I'm thinking there is hardware problems. This runs on a Win2k3 virtual machine under terminal services. The base server OS is Win2k3 with 64 GB RAM. The server has many virtual machines each running it's own "stuff" (Exchange, etc..).

Either there's hardware problems, or the .NET environment is not as easy to program against as one may think.

If the hardware were somehow verified (a entirely different story) and the application continued to behave as such would it be a feasible route to take (rewrite closer to the metal)?

I'm not a big fan of virtual machines and doubt their integrity. (Especially on huge servers.)

Edit - Thanks to all for the responses. The issue turned out to be a single .NET .DLL in my application that was not being targeted to x86 code. The COM objects are all 32 bit, the OS is 64 bit, thus my .NET application needs to be targetted to 32 bit. (This explains why my sample VB6 apps always worked. Not that I really wanted to go that route anyway.)

0 投票
2 回答
13648 浏览

.htaccess - .htaccess 带或不带斜线

我需要对以下重写规则做些什么才能使其生效,无论它们是否是 URL 末尾的斜杠?

IE。 http://mydomain.com/content/featuredhttp://mydomain.com/content/featured/

0 投票
3 回答
793 浏览

asp.net - 是否可以在 IIS6/7 上更改 ASP.Net 中请求的主机名?

是否可以在 ASP.Net 中更改请求的主机名?我们需要它来将所有对 abc.xyz.com 的请求重写为 abc.xyz.com/sites/abc(我们正在运行 Sharepoint)。
我知道这可以通过 ISAPI 实现。我们正在运行 IIS7。

0 投票
2 回答
556 浏览

.htaccess - 为什么我的 .htaccess 是 www。强制导致外部表单在没有 www. 的情况下失败。

由于奇怪的跨域 AJAX 问题,导致 AJAX 请求在不使用 www 时失败。(与请求通信的 PHP 处理程序是在相对路径中给出的,所以它不可能是地址问题或其他什么 - 这就是这个问题大约虽然),我已经强迫 www。使用 .htaccess :

这很好用。但是,我想允许其他网站管理员在他们的网站上发布我的表单之一,在他们的表单操作属性中使用我的表单 URL。这总是有效的,但是在我的 .htaccess 更改之后,表单仅在网站管理员添加 www 时提交。到动作值。没有万维网。该表格将不会被提交。

我应该如何更改我的 .htaccess 文件以确保在没有 www. 的情况下也提交这些表单?

0 投票
2 回答
823 浏览

php - IIS7 + PHP + Zend - 不执行 <= *pic*

我已经安装了 PHP、IIS7、IIS 和 Zend 的重写模块。

我可以很好地执行 PHP 页面,甚至显示 PHPINFO。

我在 IIS 上设置了一个 Zend 快速入门应用程序,当我打开它时,我看到的是:

您可以从源代码中看到它没有执行 <= 部分。

知道需要改变什么吗?

替代文字 http://www.gonrad.com/200902/zendiis.jpg

0 投票
5 回答
8300 浏览

nginx - 使用 nginx 重写来隐藏或清理 URL?

问候。

我一直在尝试理解正则表达式和重写,但我是新手。我有一个简单的站点,只有一个目录,我想要的只是将 domain.com/file.php?var=value 重写为 domain.com,确保用户在整个站点导航过程中只会在地址栏中看到 domain.com(即使我开始让网站变得更复杂)。

简单地说,它冻结了 url,虽然如果网站增长,我宁愿做一些“干净的 url”方法,但我仍然在基本 php,我觉得我必须在 http/1.1 上进行 rtfm

0 投票
2 回答
2030 浏览

regex - 如何重定向子文件夹以在 IIS 7.0 的 Mod Rewrite 中查询?

我正在使用来自 iis.net 的 Mod Rewrite for IIS 7.0 并希望重定向请求:

我创建了 2 条规则:

它通过测试进入 iis mmc 测试对话框,但不在调试中(URL 像http://localhost:9080/example.com/users/1.../users/foo)并且不在真正的 IIS 上!

我做错了什么?

0 投票
10 回答
90295 浏览

regex - 在每个 url 的末尾添加斜杠(需要为 nginx 重写规则)

我尝试在每个网址末尾添加一个“/”:

example.com/art

应该

example.com/art/

我使用 nginx 作为网络服务器。

我需要为此重写规则..

为了更好地理解,请检查:

http://3much.schnickschnack.info/art/projekte

如果您按下大图片下的小缩略图,它会重新加载并显示此网址:

http://3much.schnickschnack.info/art/projekte/#0

如果我现在在所有 url 上都有一个斜线(最后),它可以在不重新加载网站的情况下工作。

现在我在 nginx-http.conf 中有这个设置:

如何配置 nginx 以添加斜杠?(我认为我应该重写规则?)