dtvjl64442 2015-06-10 23:31
浏览 37
已采纳

从URL创建php变量而不是get

I'm generating a download link which I sent through email to download a pdf file. There are some parameters (base64 encoded) in the download link to verify the correct profile/user. I want to be the download link as follows:

www.example.com/download/ZW5jb2RlbXljb2Rl

The parameters are directly added after the subdirectory. I know it can be done with php GET as follows: www.example.com/download/index.php?base64=ZW5jb2RlbXljb2Rl

But in my opinion it is nicer to use the first URL. Except I have no idea how to accomplish this with php. My guess I have to make a rewrite in htaccess?

I found this thread: Rewriting a URL to a PHP parameter from inside a subdirectory

But I already have some htaccess rewrites (JOOMLA), and it is just for the only folder...

Thanks for your effort!

  • 写回答

2条回答 默认 最新

  • dsz1966 2015-06-11 01:07
    关注

    You have no choice but to use rewrite for this That's what it's for.

    But I already have some htaccess rewrites (JOOMLA), and it is just for the only folder..

    This absolutely does not matter. Your Apache setup can contain as many rewrites as you need. I've seen 100's.

    So you could just add these rules above your current Joomla rules and it should work.

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^download/(.+)/?$ /download/index.php?base64=$1 [L]
    

    Otherwise you would have to do what Jonathan said and use index.php in your URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求给定范围的全体素数p的(p-2)的连乘积
  • ¥15 VFP如何使用阿里TTS实现文字转语音?
  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页