Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

hosts file does not support url to url syntax, only url to ip. Ubuntu 12.04

share|improve this question
    
Correction: hosts file does not support URL to anything. It only works with "host to ip" kind of redirections. –  grawity Aug 12 '12 at 14:16
    
oh, yes, I need exactly url to ip. –  scythargon Aug 12 '12 at 16:14
    
For url-to-ip you should think about DNS; and now your comment not longer matches your question... url-to-url? url-to-ip? please get your intent clear and then update the question itself. –  nik Aug 12 '12 at 16:25
    
damn, URL TO URL! site1.com/url1 to site1.com/url2 –  scythargon Aug 14 '12 at 10:21

1 Answer 1

up vote 1 down vote accepted
  1. Setup local web server (Apache would be fine).

  2. Use host file to point URL to local IP.

  3. Use Apache's mod_rewrite to rewrite the URL. Or, you can put an index.html file in the DocumentRoot of web server & redirect using JavaScript or HTML meta refresh.
    You can also go one step further to install PHP and redirect URL using index.php.

share|improve this answer
    
For step 3, you can get codes with one Google search (if you don't know how to do that). Or, just ask me for baked codes. At this time, I am on mobile so unable to type codes quickly. –  Sachin Shekhar Jun 30 '13 at 3:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.