PDA

View Full Version : 301 redirect issue


chabbs
02-18-2008, 11:54 PM
I decided to move all my articles over to the Dynamics program and 301 redirect the old URLs to the new. I'm also using the mod rewrite for SE friendly URLs in Dynamics. I was noticing through my traffic logs that there was a funny URL when people coming from the old URL articles to the new. After using a HTTP header status tool I discovered that the old URL was being redirected to the new URL the way it's supposed to be, but the new URL was then 302 redirected to a funny URL that would land the people within the article category. I think that the htaccess for Dynamics is somehow causing a temporary 302 redirect.

Brian
02-19-2008, 12:05 PM
What exactly are you redirecting to? Are you redirecting to the showentry.php file, or are you redirecting to the SEO URL (category_title-catid/entry_title-entryid)?

Our Sponsors
 

chabbs
02-19-2008, 03:29 PM
I'm redirecting articles that were being managed by another CMS program. I copied the articles from the other CMS program into Dynamics and then redirected the old URL to the new one.

I attached the http header status in a text file for you to see.


Notice how the original URL redirects properly and then how the new URL redirects again but with a 302

I removed the redirect for now and its showing a 404 in place where the old URL was until I fix this issue.

chabbs
02-26-2008, 08:00 PM
I guess this issue is not that easy to resolve. Are you using 302 redirect in the htaccess to make the URLs SE friendly?

Our Sponsors
 

Brian
02-27-2008, 11:08 AM
I'm not really seeing anything obvious in that file... How exactly are you redirecting the URL's? Can you post the exact code you're using?

chabbs
02-29-2008, 04:09 PM
I decided to drop the SE friendly URLs and simply use the default set up. Thanks for the help.

aproape
04-18-2008, 03:21 AM
Hi Brian!

I was doing some SEO analysis on our site and found out that - for the Dynamics area at least - there are LOTS of 302 redirects.

We do not have anything else added on top of Dynamics [vbSEO is installed but it doesn't affect it..]

Looking a bit through the code - the issue seems to be the usage of the function exec_header_redirect => redirecting to the URL invisibly.

XHTML validators have some problems with this method => * Problem with URL: http://www.domain.com/dynamics/cat-53/? redirects more than 5 times. Please enter the final URL instead

Can you tell us how to fix it and use standard redirect instead? [although - I am not sure I understand why there have to be multiple redirects in the first place.. ]

Thanks!

aproape

aproape
04-18-2008, 03:23 AM
Addendum: the usage of the exec_header_redirect is found in vba_dyna_plugin_sf.php file, when crafting the SEO'ed url/response.

===

We're using VB3.6.8pl2 with Dyna v1.0 Gold.

Thanks in advance for your help..

Brian
04-18-2008, 12:19 PM
There should not be any reason that it's redirecting 5 times. The only time the exec_header_redirect() function is used is if someone tries to go to the old URL (ex: dynamics/browsecategory.php?c=1 instead of dynamics/main-1/).

aproape
04-23-2008, 10:38 AM
Hi Brian,

There should not be any reason that it's redirecting 5 times. The only time the exec_header_redirect() function is used is if someone tries to go to the old URL (ex: dynamics/browsecategory.php?c=1 instead of dynamics/main-1/).

Actually - we do have 302 redirects all over the place - JUST for Dynamics.

VB is working fine - no 302's at all.

I did a bit more digging on the reason and it seems that 302 is the _default_ method for redirecting when using RewriteRule in mod_rewrite with apache v1, which we use.

Unless you specify a different return code, apache will use 302 for any [redirect] statement/rule.

This can be avoided by using [R=301] as the 3rd parameter [around QSA,L] in your .htaccess file.

Any thoughts on how to fix this - permanently?

Thanks..


Cheers,
aproape

aproape
04-23-2008, 10:41 AM
Hmm - wouldn't be better if we could just have the regular 200 HTTP/OK response codes.. ?

aproape
04-29-2008, 11:45 AM
*bump*

any updates on this.. ?

Brian
04-29-2008, 12:42 PM
Errr, not sure what type of update your're looking for... If you're running an outdated version of Apache that isn't redirecting properly then you should either upgrade to Apache2, or alter your .htaccess file to add the [R=301] flag.

aproape
05-01-2008, 04:20 AM
Hi there Brian,

Errr, not sure what type of update your're looking for... If you're running an outdated version of Apache that isn't redirecting properly then you should either upgrade to Apache2, or alter your .htaccess file to add the [R=301] flag.

The version of apache is just a different branch, latest version.

The v1.3 branch from apache has been using mod_rewrite successfully for many years now - without any redirect response headers.

---

The R=301 was found from trial&error - however - it's not fully functional in a Dynamics configuration [the response back from the server is redirect 301 however the page doesn't display properly/successfully].

My questions are this:

1. Why, for example, vBSEO and other SE-friendly add-on's are able to redirect/mask the dynamic URLs properly - _without_ using _any_ redirect response headers? [the .htaccess supplied with vBSEO has no R=301 or anything special]

2. Why other scripts can do it - again - successfully - on apache v1.3 - without any alterations of the default mod_rewrite handling in the .htaccess - and return a 200 OK without anyone noticing link change and showing as a practical static content page?

We're just trying to solve this problem and have the pages indexed properly. Because of the 302's [on ALL categories listing and articles pages in Dynamics] the bots are not very happy to crawl and index.

Cheers,
aproape

aproape
08-22-2008, 10:48 AM
Hi there -

Chabbs - or anyone else interested in this issue.. please see:

http://www.vbadvanced.com/forum/showthread.php?p=153205#post153205


Cheers,
aproape

chabbs
08-25-2008, 09:57 AM
Hi there -

Chabbs - or anyone else interested in this issue.. please see:

http://www.vbadvanced.com/forum/showthread.php?p=153205#post153205


Cheers,
aproape

Thanks aproape! I appreciate you thinking of this thread when you posted in the other.

aproape
08-29-2008, 12:00 PM
Welcome chabbs! :-)

I will let everyone know as soon as we have more updates..

We actually have implemented one more feature - meta keywords _per category_ - however.. we didn't built an interface to it yet [you have to add the keywords in the db manually].

If anyone is interested - I can publish it no problem.. maybe Brian can quickly add the field to the edit category screen? ;-)


Cheers,
aproape

tfw2005
08-29-2008, 06:18 PM
I would be interested, I just did a hack that somewhat addresses that, but not as well as a full solution.

aproape
08-29-2008, 08:01 PM
Hi there tfw2005 [and everyone else!],

Ok - patch/addon attached - explanations are inside the readme.. and below:

--- CUT HERE ---

VBA Dynamics SEO category keyowrds plugin

1. Copy the dynamics_seo_cat_keywords.php file into the /plugins/ folder into your _forums_ directory [not Dynamics]. If you don't have that folder, create it and copy the file inside.

2. Add the product -> product-dyna_seo.xml

Product details:
A. A new field will be created called 'keywords' VARCHAR (255) as part of the adv_dyna_categories table
B. It will also add a new plugin called 'Keywords for vBa Dynamics Categories' with the hook at vba_dyna_browsecategory_end
This plugin will use the .php file copied at step 1. and will use the keywords from the database corresponding to each category

3. Edit the database [manually, for now] - and populate the 'keywords' field of the adv_dyna_categories table with the keywords you want to have for SEO, separated by comma.

4. Refresh the category page and.. enjoy!

--- CUT HERE ---

Now, Brian.. if you can make a quick addition to the edit category screen.. maybe add a new field for this.. [and maybe for the other seo meta tags as well] - hmm - I think it will be great! :-)


Cheers,
aproape

larina
08-31-2008, 08:10 AM
Thank you very very much, aproape, this is really great! :)

Just a quick note ...
For multi instances of dynamics and so for different table names, the file product-dyna-seo.xml must be edited before importing in the following line:
<installcode><![CDATA[$tableName = 'adv_dyna_categories';
Replace adv_dyna_categories with the table name you use.

It works great, thanks again!

larina

aproape
09-02-2008, 08:03 PM
You're welcome larina..

and.. we are not stopping here ;-)

I want to also address the keywords and other meta tags options.. umm.. just to have all options available! :-)

I will keep you all posted on the progress/updates.


Cheers,
aproape

larina
09-08-2008, 04:16 PM
Thanks aproape! :)

For those who need the same for Links Directory, I've edited aproapes hack to make it work with Links Directory: http://www.vbadvanced.com/forum/showthread.php?t=31486

larina