/    Sign up×
Community /Pin to ProfileBookmark

301 redirects – probably a simple answer!

I’d appreciate a little help! I’ve recently changed my company (and therefore website), and have started redirecting from the old website to the new one. Most parts are straightforward, even for me! For example, the four pages I have within a “skills” folder have been redirected as follows:

redirect 301 /skills/communication [url]http://www.trainingreality.co.uk/communication-training[/url]
redirect 301 /skills/personal-development [url]http://www.trainingreality.co.uk/self%20knowledge[/url]
redirect 301 /skills/teamwork [url]http://www.trainingreality.co.uk/teamwork-training[/url]
redirect 301 /skills/leadership [url]http://www.trainingreality.co.uk/leadership-training[/url]

works fine.

The problem I want to fix is that there is a “parent” page (I think that’s the right terminology) which is /skills ([url]http://www.skill-build.co.uk/skills[/url]). I want to redirect this to another page in the new website, but if I use:

redirect 301 /skills [url]http://www.trainingreality.co.uk/what[/url]

it not only redirects the parent page, but it affects the child pages as well. If I use this code, the teamwork child page (for example) goes to:

[url]http://www.trainingreality.co.uk/what/teamwork[/url]

which doesn’t exist. I know I could create pages to fit with these redirects, but wondered if there was a more elegant solution.

Thanks for your help.

Simon.

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@verikalNov 07.2009 — do you set this redirects with a control panel or code or else ?
Copy linkTweet thisAlerts:
@SimonRoskrowauthorNov 09.2009 — I do it via a .htaccess page.

I've done a bit more investigation, and it seems that (at least part of) the problem is that the site I am redirecting from also uses rewrites for the page names - not something I'm familiar with.

If anyone can help with explaining the following code, I'd be grateful:

RewriteEngine on

RewriteCond $1 ^(weblog|site|member|search|home|ethos|skills|formats|contact|extra|sitemap|why_it_works|P[0-9]{2,8}) [NC]

RewriteRule ^(.*)$ /index.php/$1 [L]

Thanks, Simon.
Copy linkTweet thisAlerts:
@KorNov 09.2009 — 
If anyone can help with explaining the following code, I'd be grateful:

RewriteEngine on

RewriteCond $1 ^(weblog|site|member|search|home|ethos|skills|formats|contact|extra|sitemap|why_it_works|P[0-9]{2,8}) [NC]

RewriteRule ^(.*)$ /index.php/$1 [L]

[/QUOTE]

By short, even if I am not an expert in .htaccess, I can say that the code will redirect all the address which contain "weblog" OR "site" OR.... to the same address, but written as .../index.php/weblog... OR .../index.php/site... OR...

It inserts a [B]/index.php/[/B] in your address.

As a note, your redirect code above is not a 301 redirect. If you need it to be a 301, the last line should be:
<i>
</i>RewriteRule ^(.*)$ /index.php/$1 [[COLOR="Blue"]R=301[/COLOR],L]
×

Success!

Help @SimonRoskrow spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...