2012-02-10 78 views
0

我在尝试找出htaccess重写时遇到了问题。.htaccess - 更改URL的外观

我用笨的一个项目和IM各具特色的URL像这样

http://www.website.com/profile/u/crispybenz 

其中URL的最后一段是用户唯一的用户名。

我希望人们使用

http://website.com/crispybenz 

这有可能是能够访问它?

+0

'IM各具特色像so'的网址,这是否意味着你已经有一些RewriteRules?你也必须展示他们。 – Cheery 2012-02-10 04:58:23

+0

对不起,我没有任何现行规则...它就像codeigniter使用www.website.com/controller/function/username – BigJobbies 2012-02-10 05:13:01

+0

投票关闭:[Exact Doop](http://stackoverflow.com/questions/ 7618633/routes-in-codeigniter-自动) – 2012-02-10 05:52:19

回答

0

我认为这将在htaccess文件工作:

Options +FollowSymLinks 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /profile/u/$1 [L] 

如果犯规存在的文件夹,它会尝试http://website.com/profile/u/NONEXISTENT_FOLDER