I’m using Codeigniter, now the rewrite is working fine for accessing using domain name, here is the default Codeigniter htaccess:
RewriteRule ^(.*)$ index.php?/$1 [L]
But I want to make it able to access using IP address as well and I host my website in a shared hosting with cPanel, so the IP address will be something like this: http://11.11.11.11/~username
. But it just not working when I access using IP, I had tried adding a RewriteBase and also something like:
RewriteRule ^(.*)$ ~username/index.php?/$1 [L]
and
RewriteRule ^~username/(.*)$ index.php?/$1 [L]
but non of them work. Anyone please help? Thank you.
2
Answers
Ok I just found the solution, I should check the host so that RewriteBase only will work properly:
Ping,
Unfortunately, you can not use IP as host while you’r on shared hosting. Share hosting shared single IP for multiple websites.
You need dedicated hosting or VPS for your purpose.