Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter multiple application with subdomains and correct htaccess
#1

I've a question and in fact I couldn't find solution in the posts. I'm developing a website, and it have subdomains. I want to use latest version of CodeIgniter framework. My structure is attached.

[font=Arial, 'Helvetica Neue', Helvetica, sans-serif]I put apllication folder in admin and user folder, because I want to show application_main, when url iswww.domain.com, and show admin application, when url is www.admin.domain.com, and show user folder, when url is www.user.domain.com. I've modified windows host file to test these on local, eveything is good work, but there is some problem:

1. I've created htaccess file in root and admin and user folder, to create user friendly url, and in fact, remove index.php in url.[/font]


[font=Arial, 'Helvetica Neue', Helvetica, sans-serif][font=Arial, 'Helvetica Neue', Helvetica, sans-serif]But it worked just in root! When I type www.domain.com/cotroller/method, it worked, butwww.admin.domain.com/controller/method, not worked! It shows 500 internal server error. when I put index.php (www.admin.domain.com/index.php/controller/method), it worked. first I was resolve this, and then...
[/font]
[/font]

2. I want to just access application via subdomains. I don't want this work:www.domain.com/admin/cotroller/method or www.domain.com/user/cotroller/method, just via subdomains, like this: www.admin.domain.com/controller/method.
[font=Arial, 'Helvetica Neue', Helvetica, sans-serif][font=Arial, 'Helvetica Neue', Helvetica, sans-serif]Thanks for attention, and sorry for heavy text... any help?[/font][/font]

Attached Files Thumbnail(s)
       
Reply
#2

first thing i would do is move the 'system' folder outside your 'public_html' folder and change your pathing in the various index.php files to reflect the new path. This makes the 'system' folder inaccessible via the web. But still accessible to the application folders.

as for the htaccess file in the subdomain folders i am not all the well versed in the htaccess commands but a quick google search turned up this :

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain\.com/subdomain/index.php/$1 [L]

just replace : 'subdomain' in the last line with the appropriate folder name.

hopefully this helps
"I reject your reality and substitute my own" - Adam Savage, M5 Inc.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB