【发布时间】:2011-08-21 23:40:00
【问题描述】:
我正在尝试使用 .htaccess 更改我的 url 类型,但我遇到了一些问题。我尝试了一些在线工具,但它们甚至不适合我。所以这就是我想要做的事情;
我有像http://mydomain.com/profile.php?u=newuser 这样的页面,我想这样制作:http://mydomain.com/newuser 但到目前为止我无法实现。
这也是我尝试过的;
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) profile.php?u=$1
在 .htaccess 中进行更改后,我是否还必须对我的 php 文件进行任何更改?另外,当我尝试打开http://mydomain.com/newuser 时,我注意到页面上的一些图像消失了,这是什么原因?非常感谢你们!
【问题讨论】:
-
您是否尝试将 as / 放在 (.*) 之前?你还需要比你更具体。
标签: php apache .htaccess url-rewriting