LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-23-2011, 04:22 PM   #1
jprine
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
301 redirect not working after setting up .htaccess file


Hi,

I have an old web server (windows box) and a new web server (lamp server running RHEL 5). The old web server is now known only by its IP address and the new one has the domain name formerly belonging to the old one.

Now I need to permanently redirect domain.com/subdirectory1/subdirectory2/subdirectory3 /filename.html back to the old server using the IP address. This is just for one file. So I set up
/var/www/html/subdirectory1 and put a .htaccess file in it reading:

Code:
RewriteEngine ON
Redirect 301 /subdirectory1/subdirectory2/subdirectory3/filename.html http://000.000.000.00/subdirectory1/subdirectory2/subdirectory3/filename.html
I did chmod 644, made sure mod rewrite was loaded and restarted Apache.

The redirect isn't working. Can anyone tell me what I'm missing or did incorrectly?

Thanks.
 
Old 09-23-2011, 05:03 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Hi,

mod_rewrite has nothing to do with the Redirect directive, although you can achieve the same result with both
Anyway, you should make sure apache is aware of .htaccess files. This is done by
Code:
AllowOverride All
So check httpd.conf and change it accordingly

Regards
 
  


Reply


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
Redirect with htaccess chandranjoy Linux - Server 1 02-16-2011 08:40 AM
URL Rewriting not working, .htaccess file in a subdirectory. vikram_cvk Linux - Software 1 12-29-2010 09:53 PM
htaccess 301 rewrite BillKat Linux - Server 2 04-07-2009 01:54 PM
cannot get 301 redirect to function geoman Linux - General 4 01-17-2006 09:23 PM
Htaccess with a redirect Diode Linux - Networking 0 10-28-2003 07:23 PM


All times are GMT -5. The time now is 03:04 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration