944,167 Members | Top Members by Rank

Ad:
Jul 20th, 2006
0

How to perform redirects using htaccess file

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mark Donovan is offline Offline
5 posts
since Jul 2006
Jul 20th, 2006
0

Re: How to perform redirects using htaccess file

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mark Donovan is offline Offline
5 posts
since Jul 2006
Jul 20th, 2006
0

Re: How to perform redirects using htaccess file

The first argument for the redirect should be a relative path and not a full URL
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Jul 20th, 2006
0

Re: How to perform redirects using htaccess file

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mark Donovan is offline Offline
5 posts
since Jul 2006
Jul 20th, 2006
0

Re: How to perform redirects using htaccess file

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.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
MamawDenise is offline Offline
24 posts
since Jul 2006
Jul 20th, 2006
0

Re: How to perform redirects using htaccess file

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mark Donovan is offline Offline
5 posts
since Jul 2006
Jul 21st, 2006
0

Re: How to perform redirects using htaccess file

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
1andyw is offline Offline
9 posts
since Feb 2005
Jul 21st, 2006
0

Re: How to perform redirects using htaccess file

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mark Donovan is offline Offline
5 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Content container's shadow displaying differently ???
Next Thread in HTML and CSS Forum Timeline: IFRAME and window positioning





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC