dongxiaoying5882 2015-04-28 16:24
浏览 35
已采纳

index.php上的PHP Url重定向

I am self learning php and started some coding for a web portal. I would like to develop the portal with url that should look like index.php?page=dashboard. If i put the dashboard.php in browser, it should not be displayed.

Queries that i have.

1.how to program to use pages like index.php?page=dashboard rather that having seperate php files like dashboard.php

  1. How to make the url look like from www.example.com/index.php?page=dashboard to www.example.com/dashboard
  • 写回答

3条回答 默认 最新

  • doureng5668 2015-04-28 16:31
    关注

    You can use apache mod_rewrite for that, i.e.:

    Create a file named .htaccess on the root of your website and put the following contents:

    RewriteEngine On
    RewriteRule ^dashboard$ /dashboard.php [L]
    

    This way, when a user navigates to www.yoursite.com/dashboard apache will redirect him to dashboard.php without changing the url.

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

报告相同问题?

悬赏问题

  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。