austin
austin

Reputation: 89

How to access a website in my localhost without typing the whole URL

I want to call my website in localhost using abc.in instead of typing localhost/projectname/index.php/Controllername/method

Upvotes: 0

Views: 809

Answers (1)

Ricardo Garza V.
Ricardo Garza V.

Reputation: 909

you should take a look at editing your hosts file for your OS, you should be able to write something like this inside to make it work.

127.0.0.1 abc.in

Just remember it is still a local address, so it won't work online, only in the development machine. here is a sample link with instructions for all the main OSs

https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

if you follow up to this point you should be able to access using the following url

abc.in/projectname/index.php/Controllername/method

added to this you are looking for virtual hosts, and that is very dependent on whether you use apache, nginx or whatever other server you might be using. If you set up correctly the virtual host, at this point you should be able to access your project using

abc.in/index.php/Controllername/method

And after that if you wanna go even further I recommend you dive into the documentation for pretty urls from your framework witch looks like code igniter, in such case I leave the link to the documentation here:

https://codeigniter.com/user_guide/general/urls.html

Remember all of this is still in your localhost so it won't be accessible from another machine, and except for the last step, it will be a part of the environment configuration not of your project.

Upvotes: 1

Related Questions