0

I want to change my URL totally, for example I have a URL like this:

www.myurl.org

I require:

www.change.com  

Whenever anyone open:

www.myurl.org

Then open my site and change URL in URL bar, How can I do that?

Edit: I do not want the user to be redirected to that site. I want the url in the address bar to be changed to www.change.com while the user is actually on www.myurl.org.

Sina R.
  • 1,781
  • 2
  • 19
  • 37
Axeem
  • 670
  • 4
  • 16
  • 26

3 Answers3

3

Here is your answer: Please believe me.(-;

You can't do it in internet. Maybe you can do it on your local network.

Please think if it was possible. Then how we could trust internet and websites?

Sina R.
  • 1,781
  • 2
  • 19
  • 37
  • Believe me this is very easy just one line in .htaccess but problem is that I can't know about .htaccess files – Axeem Sep 28 '13 at 01:43
  • 1
    what? so you mean I can do something when you try to go to stackoverflow.com you see mysite with a url stackoverflow.com? – Sina R. Sep 28 '13 at 01:45
  • check this this only changes path not domain and its with javascript. http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page – Sina R. Sep 28 '13 at 01:50
  • No, When you write stackoverflow.com you go in this site but just change url in browser bar like google.com but you are present in stackoverflow.com not google. just change url in browser bar note redirect in google.com – Axeem Sep 28 '13 at 01:51
  • and there is another thing named symlink which simulates links. (you can use it with .htaccess and PHP) then when you enter one path another path will execute. – Sina R. Sep 28 '13 at 01:52
  • 1
    ok, I know but your question is because your information about network lakes am I right? Or at least tell me how we can surf web then. Imagine I'm searching my bank's url on a search engine and when I click on the link browser shows my banks address and then I enter my accounts information. – Sina R. Sep 28 '13 at 01:59
1

Any hostname that is directed to your app will be re-written to use change.com. The RewriteCond allows requests to change.com to pass through, and and the RewriteRule rewrites all other URLs.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?change.com$ [NC]
RewriteRule ^(.*)$ http://www.change.com/$1 [L,R]

Oh course, you must have mod_rewrite enabled. And It may or may not be allowed in .htaccess files depending on your Apache Configuration.

Here is the Apache Documentation on the topic.

whitehat101
  • 2,428
  • 23
  • 18
  • 1
    While this seems like an answer to the question, the OP has clarified in comments that they *don't* want a redirect; they just want the URL bar in the browser to show the wrong URL. – IMSoP Sep 28 '13 at 06:11
  • It's not a redirect, it's mod_rewrite. It's also "Believe me this is very easy just one line in .htaccess" like OP said. Well, 3 lines... – whitehat101 Sep 28 '13 at 07:08
  • @jeremy - You are right - But the OP wants an impossible thing: ie when you are visiting site1.com the url changes to site2.com but the browser stays on same page like user think that he has been redirected. kind of fake url to hack people. Please check comments and my answer. – Sina R. Sep 28 '13 at 08:01
  • 1
    @Jeremy It's a redirect generated by mod_rewrite; that's what the `R` flag stands for. The browser doesn't know or care what *casused* the redirect, it will still redirect the user to the new URL. This, unfortunately, is not what the OP wants, as imsiso says. – IMSoP Sep 28 '13 at 12:54
0

You could use a good old iframe

bren
  • 4,176
  • 3
  • 28
  • 43
  • no you can't cause the OP wants the exact opposite of that. He wants this. ie when you are visiting site1.com the url changes to site2.com but the browser stays on same page like user think that he has been redirected. kind of fake url to hack people. Please check comments and my answer. – Sina R. Sep 28 '13 at 08:03
  • Why do you want to do this anyway? – bren Oct 01 '13 at 03:06
  • what you mean? what I want to do. ( or you meant the person who asked the question?) – Sina R. Oct 01 '13 at 03:10
  • Person who asked the queston – bren Oct 01 '13 at 03:16
  • oh sorry but you can add @+ his name. – Sina R. Oct 01 '13 at 04:46