If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / Is there a "Redirect permanent" override for old infopages urls?

Is there a "Redirect permanent" override for old infopages urls?

Locked

Started by justwade on 3 Dec 2006, 11:57 PM · Views: 2,788

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
3 Dec 2006, 11:57 PM
#1
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Is there a "Redirect permanent" override for old infopages urls?

I had a common infopage of resources that was bookmarked by other sites but can not seem to get it to permanently redirect to the new ez-page of same info. I would like to keep their links working to this page.

I noticed that all the old info page urls will go to main page after I upgraded to 1.3.6. being they no longer exist with same url. (I rebuilt all with ez pages.)

I added a redirect in my root .htaccess file but it does not seem to work. I mean, if I use the old url it just goes to my index main page.

Is there an override built into to the 1.3.6 cart htaccess keeping me from doing this? Something to do with the unwanted snooping protection?

I should add that I, thinking I was doing the right thing, added the codes for security per the 1.3.6 Docs to my root .htaccess. Now today I reread this info and it says to put it "if" there is "no htaccess files". So I removed the added code and now my root htaccess file is only containing the "redirects permanent" list that I always had. All these redirects are still working but not this one infopage url to new ez page url. And I tried this before and after removing the security code, there is no differance.

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

4 Dec 2006, 4:00 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Is there a "Redirect permanent" override for old infopages urls?

If you used the SQL converter to move all your infopages to the ezpages table and are now only using them as ezpages, you could alter your infopages code to redirect to ezpages like this:

/includes/modules/pages/infopages/header_php.php
Set this in the first few lines of the file:

  $id = (int)$_GET['pages_id'];

// redirect to ez-pages
  header("HTTP/1.1 301 Moved Permanently"); 
  zen_redirect(zen_href_link(FILENAME_EZPAGES, 'id=' . $id));

This will cause all infopages URL's to be translated to the EZ-Pages URL of the same number, also causing search engines to update their indexes with the new information.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

4 Dec 2006, 4:41 AM
#3
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: Is there a "Redirect permanent" override for old infopages urls?

No, I did not use the SQL converter. I wanted to start over with a new scratch made 1.3.6. And yes, I did want the search engines and other sites to keep up.

So all I did was copy and paste the infopages text into new ez-pages. It was then that I noticed the urls were differant numbers. So I tried to redirect this one. My other infopages are no big deal. But this one does not want to redirect.

This is the code I removed today in the public_html/.htaccess thinking it would help;

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.MYDOMAINE.com
AuthUserFile /home/MYNAME/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/MYNAME/public_html/_vti_pvt/service.grp

I am not sure how the # Frontpage got there, and can't remmember putting all of this in. My backups and notes don't appear to help me either. There is a lot to digest for my little mind. The remaining code is only redirects and tested ok.

But I did notice that this code is also dynymic. That is, I saw once the above-
AuthName https://www.MYDOMAINE.com change and become the infopage url I wanted redirected(?)

This is why I thought there was an override system. I don't fully understand htaccess files, I assumed of it as a traffic cop of some sort.

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

13 Dec 2006, 5:27 AM
#4
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: Is there a "Redirect permanent" override for old infopages urls?

It looks like Frontpage may have made the code for me. I try to avoid using FP because of what others here on the forums have said about this sort of thing. But I put the code back for now. I started with FP and html before Zen Cart. And if I remove all FP ext at server I will loose all htaccess files, so thats for later. Makes no diff on my problem anyway.

I still can not get that one redirect to work for some reason that is beyond me.

All my .htm files redirect with no problem.

I rewrite the htaccess everyway I can think and no luck. I tried Cpanel's redirect and the resulted action is a created url made of the (2) urls put togeather(?) This is an error page, of course.

Is there a differance when a zen url is redirected to a new zen url?

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

13 Dec 2006, 6:08 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Is there a "Redirect permanent" override for old infopages urls?

Note these URL's:

http://blah/index.php?main_page=infopages&id=1
http://blah/index.php?main_page=page&id=1

.htaccess can only redirect based on the part in red if you desire to use a single rewrite rule. (okay, that's not entirely true, but unless you know how to write overly advanced .htaccess directives in your sleep, you're stuck with this)

Thus the recommendation to use a PHP-based redirect which is generated dynamically.
Of course, you could create rewrite rules for each of your infopages individually. You could attempt this via .htaccess, or you could use the PHP code above and simply adapt it to work with a map of old to new id numbers. Either of these approaches will work fine.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Jan 2007, 11:39 PM
#6
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: Is there a "Redirect permanent" override for old infopages urls?

I now relize what happens when you try to redirect a url such as your examples. My tests seem to prove this out.

I have been trying to grasp this advice but am very much confused. I don't know quite how to do this.

I only have "one" url for infopages that I would like to permanently redirect.
The page "was" popular and linked by other sites.

I allready have all my ezpages set up and the site was made from scratch, so no conversion from infopages were needed. (Just did copy and paste)

I assume that I can not use the php-redirect above recommended because of my scratch made site. (and I am concerned that doing the conversion sql file is now too late and will mess up my existing "popular" ezpage in search engines)
Quote from Dr. Byte in other thread; > If you were using the former "infopages" mod, there is a converter SQL script in the zc_install folder which you can run to transfer them from infopages to ezpages. But only use this if you had infopages and have no ezpages and need to transfer them. It is not an upgrade tool. Only a converter.

I assume that I can not redirect in htaccess, because it is very complicated (and I know little about coding)

Is there still a simple source of code I can find to make this redirect? PHP code without the conversion sql?

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

21 Jan 2007, 12:30 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Is there a "Redirect permanent" override for old infopages urls?

What's the URL of the page you want to redirect FROM?
And the URL you want to redirect it TO ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Jan 2007, 8:29 AM
#8
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: Is there a "Redirect permanent" override for old infopages urls?

I was hoping to redirect permanently-

http://www.mydomainy.com/catalog/index.php?
main_page=infopages&pages_id=4

to;

http://www.mydomainy.com/catalog/index.php?
main_page=page&id=2&chapter=8

Thanks for asking,

Wade

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

21 Jan 2007, 8:59 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Is there a "Redirect permanent" override for old infopages urls?

Okay, then a slight variation of my earlier suggestion:

/includes/modules/pages/infopages/header_php.php
Set this in the first few lines of the file:

  $id = (int)$_GET['pages_id'];

  $redirect_url = ($id == 4) ? zen_href_link(FILENAME_EZPAGES, 'id=2&chapter=8') : zen_href_link(FILENAME_DEFAULT);

// redirect to ez-pages
  header("HTTP/1.1 301 Moved Permanently"); 
  zen_redirect($redirect_url);

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Jan 2007, 11:25 PM
#10
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: Is there a "Redirect permanent" override for old infopages urls?

Sorry to take so long to get back, life is so distracting.

Anyway, that worked perfectly!

I did not have an includes/modules/pages/infopages/header_php.php so I went to my old 1.27d and copied it over. Replaced the small amount of code with yours, and this url is now redircting properly. Now I should try to learn what makes this tick.

Thanks again for your help, by the way, and I left some coffee on the counter for ya.
:cool:

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*