开发者

CodeIgniter on subdomain (mod_rewrite issue)

Can someone tell me how can I have mod_rewrite working on subdomain? The htaccess code here http://codeigniter.com/user_guide/general/urls.html is only working on nor开发者_开发问答mal folders, not subdomains.

Why is that and how can I get it working?

Thanks.


I've had this problem too. On certain hosts, this works:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

Notice that I simply removed the slash from in front of the index.php on line 3.

Another solution is to add RewriteBase to the block, as such:

RewriteEngine on
RewriteBase /path/to/app
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Finally, if you get 500 errors from these, you may try this technique, which works on most servers I've tried: http://codeigniter.com/wiki/Dreamhost_.htaccess/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜