Welcome Guest, Not a member yet? Register   Sign In
Codeigniter subdomain and mod_rewrite problem
#1

[eluser]koichirose[/eluser]
Hi, I googled around a lot and couldn't find a working solution for my problem.
I have this perfectly working controller(s):
www.website.com/admin
www.website.com/admin/add

Now I would like to setup a subdomain:
admin.website.com (goes to www.website.com/admin)
admin.website.com/add (www.website.com/admin/add)
etc.

I managed to do it by putting an 'A' record in my hosting's dns config:
admin.website.com -> server_ip_address

Then I have this virtual host among others (public_html is where the CodeIgniter index.php file is):
Code:
<VirtualHost *:80>
        DocumentRoot /home/www/public_html/
        ServerName admin.website.com
</VirtualHost>

And this is my .htaccess. Most of it is codeigniter default stuff, I added the lines where it says ^admin.website.com$:
Code:
RewriteEngine on

RewriteBase /~www/


RewriteCond %{HTTP_HOST} ^admin.website.com$
RewriteRule ^(.*)$ http://www.website.com/admin/$1 [L]

RewriteCond %{HTTP_HOST} !^www.website.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [L,R=301]



RewriteCond $1 !^(index\.php|forum|min|css|scripts|images|docs|robots.txt|sitemap.xml|tools)

RewriteRule ^(.*)$ index.php/$1 [L]

This works: I get redirected to www.website.com/admin when I type in admin.website.com.
The problem is that I get redirected: I would like the url to be admin.website.com instead of changing to www.website.com/admin.

Could someone point me in the right direction?
Thanks
#2

[eluser]Unknown[/eluser]
I have the same problem:

I would like that

subdomain.domain.com/func

will be redirected to the controller "subdomain" function "func" (e.g. www.domain.com/subdomain/func)
but the URL in the address bar should remain subdomain.domain.com.

Do you have a solution?
#3

[eluser]Bigil Michael[/eluser]
I have the same issue.
did u solved this problem???




Theme © iAndrew 2016 - Forum software by © MyBB