0

How to redirect page if the domain name with username ?

If I try "rodekruis.example.com" like this.. it should be redirect to "example.com/user/rodekruis". Is this possible ?

Here is my ".htaccess" file code..

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>

I have tried in route.php file like below

$route['rodekruis'] = 'user/overview/1510';

That is also not working

ammni
  • 5
  • 5

1 Answers1

0

You should add a correct .htaccess redirect.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subdomains/%1/$1 [L,NC,QSA]

https://stackoverflow.com/questions/10642426/htaccess-rewrite-subdomain-to-direc‌​tory

Community
  • 1
  • 1
Prem
  • 1,447
  • 2
  • 10
  • 21