views:

46

answers:

4

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.

A: 

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]
bigstylee
OK. Thanks for your help. I think what you suggest is what I am after. Is there not a way to collect all (like do a *.* for the posts) and then point into a folder like www.snowmenu.com/ski-snowboard-winter-sports-news/?
Chris
please see edit(s) :)
bigstylee
A: 

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.

WordPress Hardcore
A: 

OK. Thanks for your help. I have amended the code below to now be as follows. Does it look correct? Thanks again for your help?

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

RewriteCond %{DOCUMENT_ROOT}/ski-snowboard-winter-sports-news/$0 -f RewriteRule ^(.*)$ /ski-snowboard-winter-sports-news/$1 [R=301,L]

END WordPress

Chris
yes it does look ok, does it work more importantly? and for future reference it is best to add comments when wanting feedback from a specific person. i dont recieve a message when a new answer is added. and tbh you shouldnt be adding answers yourself but rather ammend to the original post stating which bit is an update. oh and one more thing, mark you code as "code" in the textarea so it doesnt mess up the formatting. think thats it.
bigstylee
A: 

The plugin mentioned by @Wordpress Hardcore works best.