doujindou4356
2012-09-24 22:22
浏览 39
已采纳

Htaccess将php文件重命名为友好的URL

my problem is i want to rename this 2 urls with htaccess and i have no idea

want to convert

mydomain.com/info.php?act=statistics
mydomain.com/info.php?act=about_us

into

mydomain.com/statistics
mydomain.com/about_us

I will be very grateful since i dont know anything about htaccess.

图片转代码服务由CSDN问答提供 功能建议

我的问题是我想用htaccess重命名这2个网址,我不知道 \ n

想转换

  mydomain.com/info.php?act=statistics
mydomain.com/info.php?act=about_us
    
 
 

 <代码> mydomain.com/statistics
mydomain.com/about_us
   
 \  n 

我将非常感激,因为我对htaccess一无所知。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzhun8449 2012-09-24 22:25
    已采纳
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /info.php?act=$1 [L]
    

    This will pass /whatever to /info.php?act=whatever The ! -f and ! -d RewriteCond checks to be sure the file doesn't exist first.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题