RedirectMatch 301 /park-home-insurance/faqs/(.*)$ /knowledgebase/$1
That should do it. If it doesnt work use full http urls.
Cheers BeautyPirate,
Although that does work by redirecting I wanted to keep the url structure as per the rest of the site I am working with. Hence looking at the RewriteRule as the best option…
However, thank you ever so much for your solution above. I shall utilise this should I not find another method.
RewriteRule ^/park-home-insurance/faqs/$ http://www.domain.co.uk/knowledgebase/ [R=301]
Even this won’t work either
Some web servers don´t allow the: ^ symbol which indicates the beginning of the url. (Has to do with how deep you can access your webserver.) Try to leave that symbol out, that did the trick for me.
Still nothing seems to budge :o( I have removed the ^ symbol.
this is my new version of the htaccess rules
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
#Park Homes FAQ Rule
RewriteRule /park-home-insurance/faqs/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,NC,QSA,L]
RewriteRule /static-caravan-insurance/faq/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,NC,QSA,L]
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
I think it’s the leading /
that might be causing it not to work.
Try this instead.
RewriteEngine On
RewriteBase /
#Park Homes FAQ Rule
RewriteRule ^park-home-insurance/faqs/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,L]
RewriteRule ^static-caravan-insurance/faq/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,L]
# BEGIN WordPress
And of course, put that above your WordPress rules.
I thought we had cracked it for a minute there Jan. But alas I am afraid it is still not working :o( 404 is showing instead.
Could it be conflicting with any other .htaccess files created by WP…
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /knowledgebase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /knowledgebase/index.php [L]
</IfModule>
# END WordPress
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Could it be conflicting with any other .htaccess files created by WP…
Not if you put them above those rules, but I think I see what it might be.
You have WordPress installed in /knowledgebase/
? I don’t think those additional rules will work there, they need to be handled in /
.
If there is no existing .htaccess
file in your /
directory, try placing this there.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Park Homes FAQ Rule
RewriteRule ^park-home-insurance/faqs/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,L]
RewriteRule ^static-caravan-insurance/faq/$ http://www.leisuredays.co.uk/knowledgebase/ [R=301,L]
</IfModule>
If there is one already then make a backup copy first and get ready to undo any of your changes quick. Just in case.
Thank you Jan, I already had it all in root as well…
It has however made some progress. which is great :o) however I was expecting that when you when to park-home-insurance/faqs that it would display the content from Knowledgebase – or have I got it the wrong way around… I wasnt wanting to redirect.
Cheers