create an alias for `localhost:8080/` as `www.my-domain.com/`
Solution 1
You can add a /etc/hosts
entry like the following:
127.0.0.2 my-domain.com
Make sure to use a lo
address unused before.
Then you add an iptables rule to redirect the traffic incoming into 127.0.0.2:8080
to 127.0.0.1:80
.
iptables -t nat -A OUTPUT -d 127.0.0.2 -p tcp --dport 80 -j REDIRECT --to-port 8080
Solution 2
For doing this on firefox, you can install the Redirector add-on. After installing, restart firefox and then go to Tools > Add-ons > Redirector > Preferences.
Click on "New Redirect...". And in the "Include Pattern" field add www.my-domain.com/
or whatever you want the redirection to occur from.
And in the "Redirect to" field, add localhost:8000
. Type www.my-domain.com/
in the "Example URL" field and click "Test pattern" if you want to confirm it works. If you see this:
You will be able to type www.my-domain.com/
to go to localhost:8000.
Related videos on Youtube
Rajat Gupta
A problem solver & enthusiastic programmer looking out for exciting work opportunities. Highly interested in building Android applications, Web development, & Server side coding involving (sql/ nosql) databases & APIs. I love solving problems, building efficient approaches & algorithms. To describe my strong points, I have pretty decent problem solving skills, fast learner & highly motivated & energetic person! Gained good experience in software development in the past 2 years working on numerous android & web development projects with companies like olready.in, twowaits.com, spactre.com. Selected among Top three finalists for LinkedIn MTV GetAJob Season 4 for Flipkart as Software Developer Intern among 50k candidates.
Updated on September 18, 2022Comments
-
Rajat Gupta almost 2 years
In ubuntu, I want to create an alias for
localhost:8080/
aswww.my-domain.com/
. So that whenever I typewww.my-domain.com/
in URL field, it shows up fromlocalhost:8080/
. What is the easiest way to set this up ? Is there any application that could just do this mapping?In windows, I used to use Fiddler2 to achieve the same goals.
-
jobin over 10 yearsDo you want this to be browser-independent?
-
saiarcot895 over 10 yearsPossible duplicate: askubuntu.com/questions/26386/renaming-localhost
-
jobin over 10 years@saiarcot895: No its not! The OP has given an example for localhost, its not how to rename it.
-
Rajat Gupta over 10 years@Jobin: Preferably yes, but browser dependent may also be acceptable.
-
Rajat Gupta over 10 years@saiarcot895: I also had a look to that question earlier but the answer there doesn't work for port forwarding..
-
-
Rajat Gupta over 10 yearsanything similar for chrome as well ?
-
Rajat Gupta over 10 yearsoops .. that is a redirect solution, not an alias.. sorry I didn't wanted this..
-
jobin over 10 years@user01: How exactly would it matter?
-
jobin over 10 years@user01: Did you have a look at the link posted by saiarcot895: askubuntu.com/questions/26386/renaming-localhost?
-
Rajat Gupta over 10 yearsactually it does.. I use domain as alias for localhost while in developemnt mode