You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

修改Rewrite规则:将代理功能从主站迁移至子目录

Adjusting .htaccess Rewrite Rules for Proxy in Subdirectory

Got it, here's how to tweak your .htaccess rules so the proxy works when both files are in a subdirectory named folder:

First, replace your existing .htaccess code with this adjusted version:

RewriteEngine on
RewriteBase /folder/
RewriteRule ^(.*)$ proxy.php?url=$1 [L,QSA]

Key changes explained:

  • Updated RewriteBase: Changed from / to /folder/ — this tells the web server that all rewrite rules in this .htaccess apply to the folder subdirectory, not the site root.
  • Simplified target path: Since both the .htaccess file and proxy.php live directly inside folder, we can reference proxy.php by its filename alone in the RewriteRule target, no extra directory path needed.

Quick verification steps:

  1. Drop the modified .htaccess and your existing proxy.php file into the folder subdirectory at your site's root.
  2. Test by visiting www.domain.com/folder/ (or append a target URL like www.domain.com/folder/your-target-site.com to confirm the proxy functionality works as expected).

内容的提问来源于stack exchange,提问作者Andy Fletcher

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:41:54