2012-11-28 85 views
0

我的网址是这样的:路由笨

http://host.com/site/forum/1/General
http://host.com/site/forum/2/Special

我想缩短喜欢的网址低于给定:

http://host.com/forum/General
http://host.com/forum/Special
以及更多

在我的路线文件,我用下面的设置这是不工作,请为解一看:

$route['forum/General'] = 'site/forum/1/General'; 
$route['forum/Special'] = 'site/forum/2/Special'; 

提前感谢!

+0

这是最好的可以使用[.htaccess](http://en.wikipedia.org/wiki/Rewrite_engine) –

+0

它应该工作你有没有添加.htaccess删除您的index.php文件 –

回答

0

使用的.htaccess

RewriteEngine on 
RewriteRule ^(.*)$ /site/$1 

但要确保rewrite_module已加载Web服务器上。

0

也许是因为你的路线重叠? 发布您的所有config/routes.php以查看问题来自哪里!

0

也许这样吗? $route['forum/General'] = 'site/forum/$1/General';