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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题