.htacces - moving all posts in root to a new category - wordpress

Could anyone please help me? I am at the last chance saloon and losing a lot of traffic. Any help would be greatfully received.
After a year based on my permalink structure, all posts were in the root so have been picked up by Google as:
snowmenu.com/postname
Since changing my categories and permalink structure, I need the years worth of posts on Google to be redirected to:
snowmenu.com/ski-snowboard-winter-sports-news/postname
Is there a way to make this happen via .htaccess?
Thank you very much to anyone who's able to help me.

Just had a look at the website and I am afraid from my knowledge their is no easy way to do this type of forwarding with .htaccess.
This is because there is no way to tell the difference in link structure from a "normal link" like (eg http://www.snowmenu.com/ski-resorts/) and what you want to be redirected to (eg http://www.snowmenu.com/ski-snowboard-winter-sports-news/latest-ski-news/). If you redirect all requests you will end up having links like http://www.snowmenu.com/ski-snowboard-winter-sports-news/ski-resorts/ which if I am right is not desirable?
The long solution would be to create a htaccess redirect for EVERY URL.
The only other solution that comes to mind is using PHP (or simular) to do a redirect within your 404 document.
EDIT
This will redirect ALL requests to the page you want. But as I said before I dont think this is what you want?
RewriteRule ^(?!ski-snowboard-winter-sports-news)(.*)$ /ski-snowboard-winter-sports-news/$1 [L,R=301]
EDIT 2
Having given it some thought I think I have have come up with a viable option. This will check to see if the requested file exists, if so it will redirect to your new directory (in theory :P).
RewriteCond %{DOCUMENT_ROOT}/ski-snowboard-winter-sports-news/$0 -f
RewriteRule ^(.*)$ /ski-snowboard-winter-sports-news/$1 [R=301,L]

You can use this plugin to avoid messing with .htaccess file directly:
http://wordpress.org/extend/plugins/redirection/
It has a nice interface for you to configure the redirection rules.

The plugin mentioned by #Wordpress Hardcore works best.

Related

/blog (subdomain) 404 errors in webmaster tools /default.htm

I am new to Stackoverflow but a friend gave me a tip to ask my question over here since he couldn't help me as well. I have google's for multiple days now and I see that my rankings are dropping again in google because of all the crawl errors. My main site is build in serif webplus X5. I have added a wordpress blog to it which can be found at www.sitename .com/blog
Google has found more than 150 crawling errors and this is growing on a daily base, the point is that google ads behind all my blog url's /default.htm
I was wondering if someone can write me a htaccess 301 code for all these url's so it will instant redirect?
Today I started with manually redirecting some url's but this will not solve my problem because everytime I add another post and new tags all these new page's will also have the same default issue.
As you can imagine this is really frustrating grrr...
I have tried a lot of code's that I had found during my search but none of them did what I would like to achieve, other tips to get rid of the default page's are also very welcome.
Thank all of you who would like to fix this problem with me
Place this rule just below RewriteEngine On rule in main WP .htaccess:
RewriteCond %{THE_REQUEST} /default\.htm [NC]
RewriteRule ^(.*?)default\.htm$ /blog/$1 [L,R=301,NC,NE]

Removing index.htm from URL

I have a WordPress blog which is functioning just fine - the URLs are set to Month/Day/Year and everything on the front-end looks and functions fine.
However, when checking my stats and Google Webmaster Tools, there's tons of 404s that look like this:
http://theURL.com/normal-wordpress-url/index.htm
Of course, index.htm does not exist at the end of the WordPress URL, so the search engine is given a 404.
I have no idea what's causing this, as everything works fine for humans.
So basically, I need a way to tell search engines to forget about the index.htm at the end of the URL.
I've tried this in the .htacess with no luck:
RewriteCond %{REQUEST_URI} /index\.htm?$ [NC]
RewriteRule ^(.*)index\.htm?$ "/$1" [NC,R=301,NE,L]
Does anybody have any suggestions?
Maybe there are different problems in here that may need solution:
Problem 1: If the crawler is the one pointing to this page there are two things that you might need to do:
Try to go to Webmaster and delete "index.htm"
Try to create a robot that will disallow "index.htm" from being seen on Google Crawler.
Problem 2: If you have distributed your urls to point to this url, Google Webmaster can tell you which webpage it is coming from exactly.
So, try to make sure that all the links pointing to "index.htm" are removed from all other urls.

Trying to visit URL without www. causes WordPress to try and load the non-existent /defaultsite page

If I try to navigate to http://vequityintelligence.co.uk then WordPress redirects the browser (301 Moved Permanently) to http://www.vequityintelligence.co.uk/defaultsite which doesn't exist, so I get a 404 Not Found error.
The htaccess file is the one that came with WordPress.
I've refreshed my permalinks by changing the permalink format.
The site frontpage is set to the 'Recent Posts' option, but changing this doesn't affect it.
I understand why I get redirected, but I don't understand where the addition of '/defaultsite' comes from.
I have searched google and SO with very few results, let alone any answers. I can't think what else might cause this.
I imagine you don't need this answer anymore, but adding it for posterity: weird as it sounds, I think it's a caching issue.
I just came across this with a client's site I'm working on, and was at my wit's end, but then found some references that said it worked okay in one browser but not another, and clearing the cache fixed it.
An easy test: if you visit the URL in a browser you've never used to visit it, do you still have the issue? If not, it's probably just a matter of clearing the cache in the browser that is giving you trouble.
In the Wordpress dashboard > General Settings, check your setting for the Wordpress Address (URL) and Site Address (URL).
This is where I made sure the ‘www.’ was unnecessary for my URL.
I'd say it's a problem with the htaccess file. Perhaps adding the following code to htaccess will resolve the problem.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This redirects non-www to www. Put this near the top so it is processed before other rules are.
Code found here

.htaccess, mod-rewrite and Wordpress

I have inherited a wordpress project and am having some problems with rewriterules in the .htaccess file. I am trying to set it up such that this url:
site.com/meet-your-team/something/somethingelse
returns
site.com/meet-your-team/index.php?page_id=30&param2=something&param3=somethingelse
This worked without any problems when it was hosted on a windows box, unfortunately it is bombing on the linux server we currently have it on.
When troubleshooting the problem, I found out that all three parameters are making it to the index.php page and wordpress is using the page id to generate the page I need. However it seems to lose the other two parameters when the page is displayed. Does anyone have any ideas how I can keep parameters 2 and 3?
This is the line of code I am using. I am new to htaccess and rewrites so forgive me if all I am missing is a single character.
RewriteRule meet\-your\-team/([^/]+)/([^/]+)/? index.php?page_id=30&category_slug=$1&profile_slug=$2 [L]
Thanks in advance for anyone willing to point me in the right direction.
I think you need to add a rule that has three things to be replaced, and if I'm not mistaken, you need to start the first string with a caret and end it with a dollar sign, so:
RewriteRule ^meet\-your\-team/([^/]+)/([^/]+)/([^/]+)/?$ index.php?page_id=30&category_slug=$1&profile_slug=$2&third_slug=$3 [L]

Cannot find .htaccess, can I create one? What else can I use to redirect html pages to blog posts

I have a website and want to redirect all its pages to posts on my blog. I browsed through my website folder but could not find the '.htaccess' file. Is it provided by the web hosting or can I create my own and use it? Can it be only used with Apache server.
If that's not possible what other option do I have for redirection.
Janice
You create your own .htaccess, by simply opening a document and saving it as .htaccess.
You'll want something like this in it:
RewriteEngine on
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
Perhaps you just don't see the .htacces file. The dot at the beginning of the file name indicates that this is a hidden file and will not be displayed normally.
If you don't want to mess around with editing your .htaccess file, Redirection is a good Wordpress plugin that handles 301 redirects, logs, etc. and is easy to use.
.htaccess is for Apache only, other web servers have their own methods of configuration and do not use .htaccess files.
Since this is tagged "Wordpress" maybe you are using that? Wordpress will create one after you've turn on pretty permalinks.

Resources