I have a question about my htaccess and codeigniter, I've been experimenting with my HTACCESS for a while. I want to rewrite a specific url(with its parameters) to specific subdomain, for example:
example.com/member/*
to:
member.example.com/*
my htaccess
currently looks like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
RewriteCond "%{HTTP_HOST}" "!^example\.com" [NC]
RewriteRule /member/(.*) "http://member.example.com/$1"
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
how can i do this?
You can use the following rule in htaccess to rewrite subdomain.
RewriteEngine On
#If the host is "sub.domain.com"
RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC]
#Then rewrite any request to /folder
RewriteRule ^((?!folder).*)$ /folder/$1 [NC,L]
Here, Replace sub.domain.com with your subdomain name and folder with the name of your folder you want to point your subdomain to.