开发者

CodeIgniter on subdomain (mod_rewrite issue)

开发者 https://www.devze.com 2023-02-19 20:40 出处:网络
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 su

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

精彩评论

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

关注公众号