我的网站有这样的网址结构:
和CodeIgniter路由文件
$route['sign-up'] = 'members/signup';
$route['blog'] = 'blog/home';
我想改为:
我的主机文件没问题:
127.0.0.1 www.mywebsite.com
127.0.0.1 mywebsite.com
127.0.0.1 blog.mywebsite.com
127.0.0.1 signup.mywebsite.com
我尝试了很多关于RewriteCond和RewriteRule的技巧,但我找不到好的搭配...
感谢的!
答案 0 :(得分:3)
我认为您甚至可以轻松“破解”您的config/route.php
文件,甚至无需修改.htaccess:
if ($_SERVER['SERVER_NAME'] == 'blog.mywebsite.com') {
$route['default_controller'] = 'blog/home';
// Other routes to your blog
} elseif ($_SERVER['SERVER_NAME'] == 'signup.mywebsite.com') {
$route['default_controller'] = 'members/signup';
// Other routes for your signup
}