重定向cgi-bin目录

发布于 2024-09-19 23:49:29 字数 356 浏览 2 评论 0原文

我的旧网站有很多使用 cgi-bin 目录的网址 例如:www.website.com/cgi-bin/etc?123

现在该网站位于运行 WordPress 的新服务器上,我想将其重定向到: www.website.com/etc/123

问题是我收到了 404 错误,这些错误没有被 wordpress 处理,甚至创建一个 direcotry cgi-bin 也会做同样的事情。

我不太确定是否可以通过 .htaccess 做到这一点 或者这与 PHP.ini 设置甚至 apache 有关?

如何 URL 重定向 cgi-bin?由于 cgi-bin 不再被使用,现在它是通过 wordpress 处理的。

谢谢

My Old site had a lot of urls using the cgi-bin directory
eg : www.website.com/cgi-bin/etc?123

Now the site is now on a new server running wordpress, and I want to redirect this to :
www.website.com/etc/123

The problem is I am getting 404 errors that are not being processed by wordpress, and even creating a direcotry cgi-bin does the same thing.

I am not too sure if I can do this via .htaccess
Or is this to do with a PHP.ini setting or even apache?

How can I URL redirect the cgi-bin? As cgi-bin is no longer being used, and nows it is being handled via wordpress.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

踏雪无痕 2024-09-26 23:49:29

您可以创建从 cgi-bin 到新目标的符号链接:

ln -s cgi-bin etc

查看“ln”的手册页以了解该命令的完整处理。如果您没有 shell 访问权限,您的 Web 服务器前端(例如 cPanel)可能可以创建此类链接。

也就是说,考虑到 cgi-bin 的特殊意义和 Web 服务器的处理方式,cgi-bin 的重定向可能不是一个好的长期解决方案。在更新 Wordpress 中的路径时,使用重定向来保持运行,然后删除重定向。

You can create a symbolic link from cgi-bin to the new destination:

ln -s cgi-bin etc

Review the man pages for "ln" for a full treatment of that command. If you don't have shell access, your web server front-end (e.g. cPanel) can probably create such links.

That said, a redirect of cgi-bin is probably not a good long-term solution, given cgi-bin's special significance and handling by the web server. Use a redirect to keep things running while you work through updating the paths in Wordpress, then remove the redirect.

以酷 2024-09-26 23:49:29

如果您有 mod_rewrite 可用并且我已经正确理解您想要的内容,您可以使用以下规则集将 cgi-bin URL 重定向到新 URL:

RewriteEngine On

# Check the query string for a number (you might need to adjust
# the regex to match your data appropriately)
RewriteCond %{QUERY_STRING} ^(\d+)$
# Perform the redirect to the new URL if the current URL starts
# with cgi-bin/
RewriteRule ^cgi-bin/(.*)$ /$1/%1? [R=301,L]

If you have mod_rewrite available and I've correctly understood what you wanted, you can redirect the cgi-bin URLs to the new URLs with the following rule set:

RewriteEngine On

# Check the query string for a number (you might need to adjust
# the regex to match your data appropriately)
RewriteCond %{QUERY_STRING} ^(\d+)$
# Perform the redirect to the new URL if the current URL starts
# with cgi-bin/
RewriteRule ^cgi-bin/(.*)$ /$1/%1? [R=301,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文