douyi8315 2013-11-26 08:19
浏览 151
已采纳

如何使用GET参数将HTTP请求重定向到静态文件

I've a Page

example.com/u/_USERNAME_

and i want to redirect the request to

example.com/u/profile.php?u=_USERNAME_

I've tried a .htaccess (in the /u/ folder) file with the following content:

RewriteEngine on
RewriteRule (.*)$ profile.php?u=$1

It redirects the request BUT the $_GET['u'] Variable contains profile.php

Where's the Problem?


I've solved the Problem:

The file profile.php was in the /u/ Folder. So the Rule redirects to the own file and the GET Parameter get lost. I've put the profile.php in the rootfolder example.com/ and it work's!

  • 写回答

1条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥200 把公众号页面和文章,嵌入到其他平台!就像搬家一样!
      • ¥20 matlab编程问题。详情如下,利用chatgpt写的代码总是达不到要求。
      • ¥15 matlab画三维流场
      • ¥100 IIC通讯数据算法分析
      • ¥15 matlab 绘制涡流场
      • ¥15 依存句法分析如何与BERT模型及GCN相结合
      • ¥66 有偿收一个会Python 与unitysocket通信,会简单mediapipe手势识别的哥
      • ¥15 药店卖药设计使利润最大
      • ¥15 模拟银行实现VIP服务
      • ¥20 ECU在实车上can通讯失败或不稳定