-3

My url is www.exam.domain.ac.in. exam is the sub domain. I want to remove the www and also index.php from my codeigniter application.

And is it possible to remove the www with php code without using .htaccess?

Please someone help me.

2 Answers2

-1

First of all you need to create .htaccess file in your root folder and then paste following code so it will work.

<IfModule mod_rewrite.c>
RewriteEngine on 
RewriteRule ^$ index.php?p=home [S=1]
RewriteRule ^/$ index.php?p=home [S=1]
</IfModule>
Vipul Jethva
  • 647
  • 1
  • 7
  • 27
  • @AshishAwasthi, First of all you need to create .htaccess file in your root folder and then paste above code so it will work fine. For more information, You will follow [.htaccess](https://httpd.apache.org/docs/current/howto/htaccess.html) – Vipul Jethva Apr 27 '16 at 13:20
  • Please update your answer as it contains only code if you can add some explanation. – Ashish Awasthi Apr 28 '16 at 04:28
-1

First of all you need to create a file with .htaccess file and then paste the following code.

<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine on

    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>