dongzhenju3015 2013-12-02 00:14
浏览 46
已采纳

Htaccess URL从文件重写到目录[关闭]

I'm trying to rewrite URL, so when a user accesses

mysite.com/something

I want it to show up the content of mysite.com/something.php, but not redirecting the user to the actual .php file.

I have many other pages like this, I want a one-for-all (wild-card) soltion, rather than setting up lines for each file.

Is there a way to do it using .htaccess?

P.S: I don't want mysite.com/something.php to be redirected to mysite.com/something too.

  • 写回答

1条回答 默认 最新

  • dongyijing2353 2013-12-02 00:16
    关注

    You can do that with MultiViews option:

    Ad this line on top of your DOCUMENT_ROOT/.htaccess file:

    Options +MultiViews
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部