1 of 4
1
New Module: Redirect Helper Lite
Posted: 24 November 2009 03:06 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009

Redirecting can be a hairy thing if you don’t know how to do it. Redirect Helper Lite is here to make that part of your life easier now. With a few clicks and strokes of the keyboard you can setup simple URL redirects for your ExpressionEngine site. You can also use Redirect Helper Lite to setup and track campaigns that utilize special URLs on your site.

Key Features

• Easily create redirects for internal URLs
• Choose between commonly needed HTTP statuses for SEO purposes
• Automatically fill in your destination URL with the built-in generator (see docs)
• Setup redirects to external websites
• Disable a redirect by setting the status to Closed (without having to delete it)

You can check out some example usage and the documentation on the project homepage on my website. Oh yeah, you can also download it there too

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 24 November 2009 06:15 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  01-23-2008

Hey Erik,

Nice module. Am giving it a test drive on a site that uses leevi’s htaccess generator + structure and have hit a minor snag though.

I know I’m using other 3rd party addons that are not your responsibility, but I’m betting this isn’t an uncommon use case - ie people implementing structure on existing sites and wanting to 301 the old templategroup/template URIs to the new structure pages. So any advice you can give would be gratefully received….

Using the module causes the site to reinserts index.php into the redirected URL string (which isn’t the end of the world at all as far as I’m concerned) but I see that it also trims any preceding slashes from the redirect URI, I can see why you’re doing that, but on my setup this causes the url to be malformed.

For example in the module settings page I have:

string to match: /my/test/redirect/
destination: /destination/page/

When I hit http://mysite.com/my/test/redirect

I get redirected to http://mysite.com/index.phpdestination/page

which then 404’s. any ideas?


Tom

PS A feature request for the Pro version - being able to upload a CSV or similar of redirects would be great for large sites - and will guarantee you at least one sale from me.

PPS I think the lite/pro structure is a really interesting model for paid add-ons - hope it works out!

Profile
 
 
Posted: 24 November 2009 07:01 AM   [ Ignore ]   [ # 2 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004

Very sweet - will definitely use this when/if I need to redirect. Will also favorite on devot-ee as soon as it’s listed there.

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
Posted: 24 November 2009 07:06 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
metadaptive - 24 November 2009 11:15 AM

For example in the module settings page I have:

string to match: /my/test/redirect/
destination: /destination/page/

When I hit http://mysite.com/my/test/redirect

I get redirected to http://mysite.com/index.phpdestination/page

The links are built based on your weblog’s Path settings. If you have Comment URL configured then it will jump to that one, if that is empty then it will use Weblog URL. I’m guessing that you have index.php in one of those for the weblog in question. Can you verify this for me? If that is the case, I will add a section to my docs about this because it definitely needs some clarification since it’s technically part of the set process for people who don’t typically fill in those values.

Note: If you’re using Structure or Pages that supersedes the path values and it just uses the page_uri

Update: You found a bug! I hadn’t tested enough with index.php being used as the site index. I’ve pushed an update out to my site and now it’s version 1.0.1. Download it and give it a try now (just re-upload the redirect_helper_lite directory replacing all files).

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 24 November 2009 07:49 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
Sean C. Smith - 24 November 2009 12:01 PM

Very sweet - will definitely use this when/if I need to redirect. Will also favorite on devot-ee as soon as it’s listed there.

Thanks Sean. I tried adding it to Devot:ee last night but had some complications which hopefully will be sorted out sometime today smile

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 24 November 2009 07:50 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  01-23-2008

Hi Erik,

Cheer for such a rapid response!

I just wrote a really detailed reply before I figured out where I might be going wrong, I’m calling the {exp:redirect_helper_lite} tag in my 404 template as on the new site I’ll be deploying the previous templategroup/templatename pages don’t exist.

If you’re building the links based on the weblog path settings I’m guessing that may revert to another value when the call comes from the 404 template?

If not then the reply I was going to post is below

best

Tom

Hi Erik

You were right that I had index.php present in my weblog path settings (I forgot to set these as I’m mostly using Structure for this site), but even though I’ve removed every instance of it (thank you dEEploy helper!) I’m unfortunately still getting the malformed URIs.

Just to be clear my actual weblog path settings are as follows:

Section URL: http://mysite.com/shows/
Comment page URL: http://mysite.com/shows/detail/

And my redirect setting looks like this:

String to match /my/test/redirect/
Destination: shows/calendar

Where /my/test/redirect points to a nonexistent page and calendar is a multientry template in my shows template group.

I’m removing index.php with LG .htaccess generator and the following rule (as suggested here)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ /index.php/$1 [L] 

Thanks again for your time mate…

Profile
 
 
Posted: 24 November 2009 08:09 AM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009

Tom

What do you have stored under Admin > System Preferences > General Configuration > “Name of your site’s index page”

This setting/preference is also considered when actually parsing the redirect. Is that set to index.php? (it is by default)

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 24 November 2009 08:18 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  113
Joined  01-23-2008

Yeah that fixed it - sorry Erik, my bad for not catching that one - pretty dumb of me.

Thanks for your time both creating the mod and supporting it - when you release the pro version I’ll be first in line!

Profile
 
 
Posted: 24 November 2009 10:14 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
metadaptive - 24 November 2009 01:18 PM

Thanks for your time both creating the mod and supporting it

You are quite welcome

metadaptive - 24 November 2009 01:18 PM

when you release the pro version I’ll be first in line!

I’ll see you there! smile

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 24 November 2009 10:58 AM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
metadaptive - 24 November 2009 11:15 AM

PS A feature request for the Pro version - being able to upload a CSV or similar of redirects would be great for large sites

That feature is actually already built in to the pro version. Thanks for the suggestion! smile

metadaptive - 24 November 2009 11:15 AM

I think the lite/pro structure is a really interesting model for paid add-ons - hope it works out!

Thanks Tom. It will be interesting to see how it works out.

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 27 November 2009 12:55 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
RankRankRank
Total Posts:  320
Joined  06-18-2007

Does this support MSM?

Profile
 
 
Posted: 27 November 2009 01:37 PM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
Richard Frank - 27 November 2009 05:55 AM

Does this support MSM?

It does not technically support MSM. If you need to create a redirect rule that only applies to one site, though, you can still do that and not ruin anything. If the matching string will only occur on a single site you would be fine.

Redirect Helper Pro will support MSM in a number of ways that will be useful.

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 27 November 2009 08:27 PM   [ Ignore ]   [ # 12 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30388
Joined  04-29-2002

Erik, what about 2.0PB? Will you have a version for that?

Profile
MSG
 
 
Posted: 27 November 2009 08:51 PM   [ Ignore ]   [ # 13 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
Sue Crocker - 28 November 2009 01:27 AM

Erik, what about 2.0PB? Will you have a version for that?

Yes, I actually intended to write it this week but my whole family has been very sick. I suspect that the 2.0PB version of Redirect Helper Lite will be available by the end of the year.

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 27 November 2009 10:49 PM   [ Ignore ]   [ # 14 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30388
Joined  04-29-2002

Thanks, Erik. Hopefully ya’ll will get better soon.

Profile
MSG
 
 
Posted: 29 November 2009 07:00 AM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  73
Joined  04-19-2009

I’m moving from a custom coded site to EE soon. So I will need to have Google redirect some 600 old site links to new EE links. I was going to use .htaccess to do this. 

It seems that I can use your module like so to do the same thing:

old site link:  mysite.com/widgetbox/blue-widget/

Create new EE template group called widgetbox and on the index template place the exp:redirect_helper_lite tag call.  Then setup the redirect in the module settings to say redirect that URL to mysite.com/EE-widgets/blue-widget/  And I tested that and it does redirect. Awesome. But….

Isn’t this a big hit on site performance when you factor in that it has to run for every page visitor that came in from the old google link?  It would be something like 13 queries (I think this is what I read an empty template is) just to load that widgetbox template group, + 1 query to the database to match a possible redirect.  I wonder how long it takes google to replace the old links with the new links in their index though.  If it is only like a week, that would be only a week of possibly tons of database calls.

I’m just thinking performance wise it is probably best to go with adding the redirects manually to my .htaccess file.

Profile
 
 
Posted: 29 November 2009 10:34 AM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
anthonys - 29 November 2009 12:00 PM

I’m moving from a custom coded site to EE soon. So I will need to have Google redirect some 600 old site links to new EE links. I was going to use .htaccess to do this.

If your new URLs are similar to your old ones you would probably benefit more from using a regular expression to match the patten of the old URL and then forward to the new URL. Example: if your old link is mysite.com/widgetbox/blue-widget/ and your new location of that link is mysite.com/EE-widgets/blue-widget/ then you might just want to replace the ‘widgetbox’ portion and not rewrite the entire URL. If you haven’t used mod_rewrite before in .htaccess I can throw some helpful links out for you.

anthonys - 29 November 2009 12:00 PM

Isn’t this a big hit on site performance when you factor in that it has to run for every page visitor that came in from the old google link?  It would be something like 13 queries (I think this is what I read an empty template is) just to load that widgetbox template group, + 1 query to the database to match a possible redirect.  I wonder how long it takes google to replace the old links with the new links in their index though.  If it is only like a week, that would be only a week of possibly tons of database calls.

Aagin, in your situation I think .htaccess may be the better route which wouldn’t even hit EE’s template parser until after the redirect. Redirect Helper (Lite and Pro) is meant to make SEO redirects easy for someone without access to server-lever rewrites or redirects but it’s primarily for ‘campaign tracking’.

That said, I’m still experimenting with a solution for Redirect Helper Pro that writes to your .htaccess file specific rules you set in the module area to minimize the impact on the server for larger traffic sites.

anthonys - 29 November 2009 12:00 PM

I’m just thinking performance wise it is probably best to go with adding the redirects manually to my .htaccess file.

Always! A server-level redirect will always be faster than running it through something like PHP. In perspective, on my personal site I currently have 14 redirects setup in Redirect Helper and only 2 of them are for SEO purposes. I will remove them after 4 weeks. The rest are for “tracking” things

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
Posted: 29 November 2009 11:01 AM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  73
Joined  04-19-2009

Erik,

Thanks for the reply.

A large number of my old links had double dashes—sometimes triple dashes and “&” and Capitalized letters so I’ve really changed the link structure on the new EE links to make them nice and clean. I don’t think it would be easy to use a regular expression to use some kind of pattern match.

If you figure out a cool system for the Pro version to write directly to the .htaccess file, please make it compatible with the LG .htaccess generator, so whenever a new template etc is added and the LG generator is ran it doesn’t wipe out the stuff your Pro version added to the file.

How long does it usually take google to re-index all the new links found through the redirects? I’m worried my traffic is going to take a major hit when I turn on the EE site and turn off the old site.

Profile
 
 
Posted: 29 November 2009 03:00 PM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1182
Joined  03-24-2009
anthonys - 29 November 2009 04:01 PM

A large number of my old links had double dashes—sometimes triple dashes and “&” and Capitalized letters so I’ve really changed the link structure on the new EE links to make them nice and clean. I don’t think it would be easy to use a regular expression to use some kind of pattern match.

Oh I see. Sounds like you have a tedious road ahead then

anthonys - 29 November 2009 04:01 PM

If you figure out a cool system for the Pro version to write directly to the .htaccess file, please make it compatible with the LG .htaccess generator, so whenever a new template etc is added and the LG generator is ran it doesn’t wipe out the stuff your Pro version added to the file.

That’s already being worked on. Thanks for the suggestion though!

anthonys - 29 November 2009 04:01 PM

How long does it usually take google to re-index all the new links found through the redirects? I’m worried my traffic is going to take a major hit when I turn on the EE site and turn off the old site.

I’m no SEO guru, but based on my experience it depends on you and how much effort you put into letting Google know your pages have moved. 301 Redirects are really a “reactive” approach because they only come into play when your site is crawled. I’d suggest searching the web for answers and solutions to that specific question. Google Webmaster Tools may also provide some resources.

 Signature 

@ErikReagan
GitHub Repos
Focus Lab, LLC
EE Pro Network

Profile
 
 
   
1 of 4
1