LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 12-09-2012, 05:28 AM   #1
suj
Member
 
Registered: Dec 2009
Posts: 33

Rep: Reputation: 1
htaccess rule to change url


HI,

can i achieve the following with any htaccess rule?

when accessing the file domain1.com/file the browser url should be show as domain2.com/file .

can anyone help..
 
Old 12-09-2012, 09:23 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Hi,

You can use mod_rewrite. In order to access anything in server1 from server2 without changing the server name in the client address-bar, you can use the following in a .htaccess in server2 docroot:
Code:
RewriteEngine on
RewriteRule (.*)        http://server1/$1 [P]
Regards
 
Old 12-09-2012, 09:37 AM   #3
suj
Member
 
Registered: Dec 2009
Posts: 33

Original Poster
Rep: Reputation: 1
thank you for the answer..but I dont have a 2nd server..i have only one domain..i just want to change the url only..cant change anything in domain2.com...the file is only at domain1.com/file..but when someone accessing that link the url part should shown as domain2.com/file..is that possible?
 
Old 12-09-2012, 10:09 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Quote:
Originally Posted by suj View Post
thank you for the answer..but I dont have a 2nd server..i have only one domain..i just want to change the url only..cant change anything in domain2.com...the file is only at domain1.com/file..but when someone accessing that link the url part should shown as domain2.com/file..is that possible?
No I don't think it's possible if you don't have the control of both servers/domains.
 
Old 12-09-2012, 10:13 AM   #5
suj
Member
 
Registered: Dec 2009
Posts: 33

Original Poster
Rep: Reputation: 1
okay..so i should host the other domain too right..thank you so much for the help.
 
  


Reply

Tags
htaccess


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
htaccess url rewriting dazzler20 Programming 1 12-22-2011 01:47 AM
htaccess rewrite rule asifbasha Linux - Server 1 09-21-2011 01:48 PM
URL Rewriting in htaccess hatchnet Linux - General 7 07-05-2010 06:57 PM
rewrite rule for url change ravibhure Linux - Server 2 01-21-2010 10:12 PM


All times are GMT -5. The time now is 06:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration