How to perform redirects using htaccess file

Reply

Join Date: Jul 2006
Posts: 5
Reputation: Mark Donovan is an unknown quantity at this point 
Solved Threads: 0
Mark Donovan Mark Donovan is offline Offline
Newbie Poster

How to perform redirects using htaccess file

 
0
  #1
Jul 20th, 2006
I have recently moved a file from one location in my website directory structure to another. Though all the linking has been properly maintained, I see I am getting 404 errors when I attempt to go the old path. I am sure I am having a syntax error but don't know exactly what the problem is.

To be specific.

I want site vistors to automatically be redirected from one location to another when they enter the old URL.

The old URL is: http://www.homeadditionplus.com/Ceil...n%20Wiring.htm

The new URL is: http://www.homeadditionplus.com/Elec...n%20Wiring.htm

my redirect code is in the .htaccess file is:

redirect http://www.homeadditionplus.com/Ceil...n%20Wiring.htm http://www.homeadditionplus.com/Elec...n%20Wiring.htm

If you have any ideas on what I am doing wrong please respond.

Thanks,

Mark
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 5
Reputation: Mark Donovan is an unknown quantity at this point 
Solved Threads: 0
Mark Donovan Mark Donovan is offline Offline
Newbie Poster

Re: How to perform redirects using htaccess file

 
0
  #2
Jul 20th, 2006
Originally Posted by Mark Donovan
I have recently moved a file from one location in my website directory structure to another. Though all the linking has been properly maintained, I see I am getting 404 errors when I attempt to go the old path. I am sure I am having a syntax error but don't know exactly what the problem is.

To be specific.

I want site vistors to automatically be redirected from one location to another when they enter the old URL.

The old URL is: http://www.homeadditionplus.com/Ceil...n%20Wiring.htm

The new URL is: http://www.homeadditionplus.com/Elec...n%20Wiring.htm

my redirect code is in the .htaccess file is:

redirect http://www.homeadditionplus.com/Ceil...n%20Wiring.htm http://www.homeadditionplus.com/Elec...n%20Wiring.htm

If you have any ideas on what I am doing wrong please respond.

Note I use Frontpage 2003 with frontpage extensions running on an Apache Server.

Thanks,

Mark
Note I use Frontpage 2003 with frontpage extensions running on an Apache Server.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: How to perform redirects using htaccess file

 
0
  #3
Jul 20th, 2006
The first argument for the redirect should be a relative path and not a full URL
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 5
Reputation: Mark Donovan is an unknown quantity at this point 
Solved Threads: 0
Mark Donovan Mark Donovan is offline Offline
Newbie Poster

Re: How to perform redirects using htaccess file

 
0
  #4
Jul 20th, 2006
Originally Posted by stymiee
The first argument for the redirect should be a relative path and not a full URL
I have tried that too to no avail. I think there is something special with Frontpage2003 extensions that is causing the problem.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 24
Reputation: MamawDenise is an unknown quantity at this point 
Solved Threads: 0
MamawDenise's Avatar
MamawDenise MamawDenise is offline Offline
Light Poster

Re: How to perform redirects using htaccess file

 
0
  #5
Jul 20th, 2006
here is a easy way to get where you want to be with out using htaccess just stick that in the body of the old page and direct it to the new one, not in the head in the body

[html]<script language='javascript'>
var1=8;
var2=var1;
if(var1==var2) document.location="http://yoursitehere";
</script>[/html]
Last edited by tgreer; Jul 20th, 2006 at 7:58 pm. Reason: User ignored directions for using CODE tags.
Scripts Installed, SEO Work Done,
Need Traffic We Can Help!
Contact Me Today! On Line Since 95
Icq:346230916
webmistress@officialwls.com
Domains & Sites
For Sale!
Some Hot Forum Names!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 5
Reputation: Mark Donovan is an unknown quantity at this point 
Solved Threads: 0
Mark Donovan Mark Donovan is offline Offline
Newbie Poster

Re: How to perform redirects using htaccess file

 
0
  #6
Jul 20th, 2006
Originally Posted by MamawDenise
here is a easy way to get where you want to be with out using htaccess just stick that in the body of the old page and direct it to the new one, not in the head in the body

<script language='javascript'>
var1=8;
var2=var1;
if(var1==var2) document.location="http://yoursitehere";
</script>
Thank you for your input, however I can not keep the old file. The reason for the need to do redirects is that I have too many files in the root directory and my host provider is indicating to me that I have to move some files.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 9
Reputation: 1andyw is an unknown quantity at this point 
Solved Threads: 1
1andyw 1andyw is offline Offline
Newbie Poster

Re: How to perform redirects using htaccess file

 
0
  #7
Jul 21st, 2006
This is taken from my file which works as designed:

Redirect 301 /firstfile.html http://www.mhanp.org/nextfile.html

//Explaination

'Redirect 301' is the command function
'/firstfile.html' is the old file relative url
'http://www.abcdef.org/nextfile.html' is the url to which
the visitor is being sent

The file holding this instruction is '.htaccess'
Notice the dot preceeding the fine name.


Andy
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 5
Reputation: Mark Donovan is an unknown quantity at this point 
Solved Threads: 0
Mark Donovan Mark Donovan is offline Offline
Newbie Poster

Re: How to perform redirects using htaccess file

 
0
  #8
Jul 21st, 2006
Thanks,

However I think I have been doing this with no success.

I use the following command in my .htaccess file:

Redirect /Ceiling%20Fan%20Wiring.htm http://www.homeadditionplus.com/Electrical%20Articles/Ceiling%20Fan%20Wiring.htm



The below old URL is what I am trying to redirect people away from:
http://www.homeadditionplus.com/Ceil...n%20Wiring.htm

The new URL to take its place is:

http://www.homeadditionplus.com/Electrical%20Articles/Ceiling%20Fan%20Wiring.htm
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC