dsaj20411 2011-07-07 02:02
浏览 16
已采纳

如何捕获url-path以执行htaccess重定向?

What I'm looking to do is take http://mydomain.com/1a3b5c and redirect it to http://mydomain.com/page?id=1a3b5c and if possible still keep mydomain.com/1a3b5c in the browser's address bar. If this isn't possible, then the simple redirect is fine.

  • 写回答

2条回答 默认 最新

  • doutan4831 2011-07-07 02:24
    关注

    What you are interested in is typically called 'Clean URLs' and is done like this:

    RewriteRule ^([a-zA-Z0-9]+)$ /page?id=$1 [L]
    

    This is assuming you are using Apache as your web server and have mod_rewrite enabled.

    It will preserve the original visible URI.

    This may need to be modified based on your precise needs, but this should give you the general direction of where to go.

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

报告相同问题?

悬赏问题

  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效