0

I have to create subsomain in my codeigniter application. what i am try is routing my URl in this way

www.example.com/subdomain 

to

subdomain.example.com/ 

it is my current .htaccess file

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?/$0 [PT,L] 

i use this script to create subdomain on server http://www.webinfopedia.com/create-subdomain-in-php.html
How i do this task. any solution with .htaccess or route.php base.

1

1 Answer 1

1

In the tutorial please modify the following line to solve your problem:

$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/subdomains/" . $subDomain; 

to this line:

$buildRequest = "/frontend/x3/subdomain/doadddomain.html?rootdomain=" . $rootDomain . "&domain=" . $subDomain . "&dir=public_html/" . $subDomain; 

after that when you access subdomain.example.com/ then it will automatically show example.com/ subdomain folder's root index.php or index.html file....

Have fun...

Sign up to request clarification or add additional context in comments.

1 Comment

i did it but it will not redirect automatically. if some .htaccess is necessary?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.