Welcome to WebmasterWorld Guest from 23.20.37.222

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

redirect permanent wildcard

     
8:27 pm on Jan 29, 2008 (gmt 0)

5+ Year Member



hi all!

I need to redirect a bunch of dynamic url's created on an e-commerce site..

anything that starts with ...

index.php?cName=

needs to be permanetly redirected to the home page, but i cant figure out how to get the wildcard working. Obviously i dont want index.php redirected, otherwise it just goes in a loop.

This is for search engine reasons.. i'm ditching the index.php?cname system due to duplicates, and there are too many to remove manually. I'm thinking if i set up the redirect to the home page they'll eventually fizzle out.

Thanks for any help :)

8:54 pm on Jan 29, 2008 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Is the "?cName=" part static? YOu have to have something static that you can match on, or you will have to do it from within the index.php itself.

Whatelse is there in the dynamic url that you can match on?

10:38 pm on Jan 29, 2008 (gmt 0)

5+ Year Member



yep the cName is always there, either that or pName..

so for example..

index.php?cName=extension-ladders
index.php?cName=loft-ladders
index.php?pName=3-section-ladder

so the only thing that is constant in the url's is cName, pName or '=' , or occasionally an '&'.

11:06 pm on Jan 29, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I can't recommend that you redirect all these pages to your home page -- It'll look like you're trying to use lots of doorway pages. Here's how you can return a 410-Gone for those URLs:

RewriteCond %{QUERY_STRING} ^[cp]Name=
RewriteRule ^index\.php$ - [G]

If you insist on redirecting these pages, then you can use something like this:

RewriteCond %{QUERY_STRING} ^[cp]Name=
RewriteRule ^index\.php$ /index.php? [R=301,L]

You'd be far better off redirecting each dynamic page to its replacement -- at least the highest-ranked and highest-traffic ones.

Jim

10:01 am on Jan 30, 2008 (gmt 0)

5+ Year Member



thanks Jim much appreciated.. i'll use the 'gone' code i thnk.

The only reason i'm not doing a straight redirect is because the pages carry no weight, arent ranked, and aren't landing pages. The index page collects 99% of traffic. There are alos a lot of dead links ('cant find product' pages) and duplicated pages, preventing good indexing of my current optimisied pages.

Given that there are about 1500 indexed pages, i think its better to ditch them , install the new system, and start again. Hopefully by the time th eold pages fizzle out the new ones (under different url's) will be indexed and working effectively.

Its a risk i know, but i dont have much choice.. i need to get my deeper pages in the serps, but the current mess is preventing it.

11:08 am on Jan 30, 2008 (gmt 0)

5+ Year Member



ps sorry, i also need to do the same for anything with ...

domain.com/product_info.php?cPath=121&products_id=
domain.com/index.php?sort=3a&page=1&cName=

ie 'product_info.php?cpath', and 'sort' in the url.

How do i amend the command to do that?

3:43 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



> ie 'product_info.php?cpath', and 'sort' in the url.

On which URL? index.php? product_info.php? Both?

You need well-defined requirements (a comprehensive list of URLs and attached query strings) before coding.

Jim

7:55 pm on Jan 30, 2008 (gmt 0)

5+ Year Member



sorry, the pages i need to remove are all variants of the following...

domain.com/product_info.php?****** - remove ALL of the product_info.php pages, or if not possible anything that contains 'cPath' after the '?' .

domain.com/index.php?******** - remove anything that contains either 'cName' , 'pName' or 'sort' after the '?'

Thanks for any help..hope it makes sense...

5:28 am on Feb 1, 2008 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member




RewriteRule ^product_info\.php$ - [G]
#
RewriteCond %{QUERY_STRING} ^[cp]Name= [OR]
RewriteCond %{QUERY_STRING} ^sort=
RewriteRule ^index\.php$ - [G]

Dig into the documentation [httpd.apache.org] a bit; This isn't hard, and reading-up beats waiting around for people here to remember to check this thread... :)

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month