Elitmiar
Elitmiar

Reputation: 36829

Using .htaccess to redirect only certain non existing url's

I have the following scenario

I have some url's that exist and some url's that do not exist with the following structure

http://site.co.za/component/docman/cat_view/388-documents-reports/test/sss/test/123 http://site.co.za/component/docman/cat_view/388-documents-reports/file/asdsa http://site.co.za/component/docman/cat_view/388-documents-reports/sadas http://site.co.za/component/docman/cat_view/388-documents-reports/sadsad

What I'm trying to achieve is when any url that contains component/docman/cat_view does not exist it needs to link to the parent url

for example

http://site.co.za/component/docman/cat_view/388-documents-reports/test/sss/test/123

needs to redirect to

http://site.co.za/component/docman/cat_view/388-documents-reports

http://site.co.za/component/docman/cat_view/388-documents-reports/file/asdsa

needs to redirect to http://site.co.za/component/docman/cat_view/388-documents-reports

so in other words all urls that contain component/docman/cat_view need to redirect to the url plus the first parameter after docman

CAn this be done using the .htaccess file together with mod rewrite and how if it can?

Upvotes: 0

Views: 264

Answers (1)

mlishn
mlishn

Reputation: 1667

yes using 301 redirects

see below for tutorial

http://www.phatz.com/301redirect.php

Upvotes: 1

Related Questions