SEO Class in Chicago, IL
Learn How To Optimize Your Website on July 26, 2013
High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!
Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Htaccess Redirect 301 Page Redirects Not Working...please Help
#1
Posted 18 October 2012 - 12:39 AM
This is an example of the top section of the file with an example page redirect line:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^clarityperformanceallianceDOTcom [nc]
RewriteRule ^(.*)$ ThisIsWhereIPutTheFullURL/$1 [r=301,nc]
Redirect 301 /clarity/[A].html ThisIsWhereIPutTheFullURL/current-performance.html
I realize that the old page is a very poorly named page (because of the brackets) but the brackets are not why it's failing. I've tried this line with other pages that don't have brackets in their names and they fail as well.
I'm on a shared Network Solutions Linux server using what I assume is an Apache server. They have their shared servers set up in what I assume is pretty typical in that my root folder is called htdocs and I can create as many subfolders and websites within them as I want to, hence why I have a subfolder named "clarity" for this particular website.
The global non-www to www redirect works perfectly. It's all the individual page redirects where I changed the page names that aren't working.
What am I missing?
Thanks a lot in advance!
#2
Posted 18 October 2012 - 09:14 AM
What am I missing?
Dunno
I'm trying to figure out what this~:
RewriteCond %{http_host} ^clarityperformanceallianceDOTcom [nc]
RewriteRule ^(.*)$ ThisIsWhereIPutTheFullURL/$1 [r=301,nc]
Is supposed to actually doclarityperformancealliance.com IS what HTTP_HOST will contain, if that is the hostname that is being requested.
Do we actually get to SEE what the URI looks like? And of course the canonical URI you want to redirect to.I realize that the old page is a very poorly named page (because of the brackets) but the brackets are not why it's failing. I've tried this line with other pages that don't have brackets in their names and they fail as well.
#3
Posted 18 October 2012 - 01:38 PM
Dunno
I'm trying to figure out what this~:RewriteCond %{http_host} ^clarityperformanceallianceDOTcom [nc] RewriteRule ^(.*)$ ThisIsWhereIPutTheFullURL/$1 [r=301,nc]Is supposed to actually do
clarityperformancealliance.com IS what HTTP_HOST will contain, if that is the hostname that is being requested.
Do we actually get to SEE what the URI looks like? And of course the canonical URI you want to redirect to.
I'm sorry but the EXTREMELY restrictive rules and moderation of this forum would not allow me to put full URLs in posts so I had to figure out a way to post my question and allow it to go through. You can trust that I have the actual lines of code formatted correctly. I just don't understand why the 301 redirect lines aren't working at all in the same htaccess file.
#4
Posted 18 October 2012 - 03:16 PM
#5
Posted 18 October 2012 - 09:57 PM
This is an example of the top section of the file with an example page redirect line:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^example.com [nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
Redirect 301 /subfolder/oldpagename.html http://www.example/newpagename.html
So the first 4 lines are working fine and doing a 301 redirect from the non-www to the www URL for the entire site.
It's the individual redirect 301 line that isn't working. I don't get an error, just no redirection.
#6
Posted 19 October 2012 - 06:29 AM
Or are you, perhaps, pointing your browser to http://subfolder.com/oldpagename.html ?
In other words, if you are creating new domains WITHIN your hosted domain, your code should treat them as domains not as subfolders. The first step in that direction would be for /subfolder (if it is, indeed, a domain) to have its own copy of .htaccess, one that addresses it by domain and not by folder name. Does that make sense at all?
If that still doesn't help, my suggestion would be to temporarily remove everything from .htaccess except the one line you feel isn't working. If it still doesn't work, you know you have a syntax problem. If it, instead, starts working, you know you have a conflict with other code. If the latter, start putting back in the code one line at a time until it breaks again.
#7
Posted 19 October 2012 - 12:26 PM
I have certainly tried removing the other lines and just putting the single line redirect and still no joy. I’m not sure I fully understand your response so please allow me to provide some very specific information that I hope will clarify things.
I have multiple websites created on my shared server Network Solutions account, which obviously is a Linux server running Apache (not sure of the version). They provide a simple pointer redirection tool in their control panel that allows one to point any domain to any folder on one’s account. My account’s root folder on their server is called htdocs. Since I have multiple sites under this account, I’ve created a subfolder for each one with no sites being stored within the htdocs root folder itself:
/htdocs/site1 /htdocs/site2 /htdocs/site3 /htdocs/site4
In their control panel, I have options to point domain names to folders and have done so as such:
http://site1.com /htdocs/ http://www.site1.com /htdocs/site1
They do not use htaccess files by default but allow one to create their own. Thus I have created the one I mentioned in this post to do a proper 301 redirect for the non-www to the www version and it’s working. My htaccess file is located in the root htdocs folder.
Of course, now I need 301 redirects for all the individual pages within each website that I am planning on changing names for and that’s what’s not working so far. I’m sure it’s something simple that I’m just overlooking.
Thanks again Ron for your help.
#8
Posted 19 October 2012 - 02:25 PM
#9
Posted 19 October 2012 - 03:05 PM
The folder /htdocs contains a subfolder /htdocs/site1, which contains all the files for site1.com. To view those files in your browser, you point the Location to http://www.site1.com. Is that correct so far?
You have a disk file at /htdocs/site1/oldpagename.html that can be viewed in a browser at http://www.site1.com/oldpagename.html. You want to redirect visitors who view that file (as distinct from reaching it on disk) to http://www.site1.com/newpagename.html. We still on the same page?
I'm going to further assume that your host is using Apache to assign /htdocs/site1/ as the Document Root for the domain site1.com. There are other possibilities, but this is probably a best-guess.
Let's look at the line that isn't working for you (with a slight change to the domain, just to be consistent):
Redirect 301 /site1/oldpagename.html http://www.site1.com/newpagename.html
Apache's redirect directive is used to map an old URL-path to a new URL. I think your problem, Steve, is that you're asking it to map a disk path (which is what /subfolder/ is) to an URL. Another way to look at it: if a browser won't understand http://www.site1.com/site1/oldpagename.html, then Apache's redirect isn't going to understand it either.
If all of my guesses are right, the solution is simple.
Create an .htaccess file in /htdocs/site1/ (you may have to abandon the safely of your control panel to do it) with one line (at least to start):
Redirect 301 /oldpagename.html http://www.site1.com/newpagename.html
Let us know, Steve, if that works for you ...
#10
Posted 19 October 2012 - 07:33 PM
Yes, thank you...I'm aware of that and it's fine.Be aware that with a physical directory setup as yours is, the .htaccess in the "root" htdocs directory is going to affect ALL websites that branch off the htdocs directory.
#11
Posted 19 October 2012 - 07:50 PM
Take care.
#12
Posted 20 October 2012 - 05:41 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users








