Zen Cart Logo
Forums / General Questions / 301 redirect from html to php?

301 redirect from html to php?

Locked

Views: 1,758

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
29 Jul 2010, 8:51 AM
#1
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

301 redirect from html to php?

Hi all, having a problem with this, it gives me a server error when I run it. I need to do a permanent redirect and I thought adding this to the .htaccess would work,
redirect 301 /categories/pool tables/american_pool_tables_p3.html http://www.cuepower.co.uk/index.php?main_page=index&cPath=20_45&sort=20a&page=3
I have a few pages to redirect, am I right in thinking the problem with this is in redirecting from a html page to a php page?
thanks in advance for any help

29 Jul 2010, 9:38 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 301 redirect from html to php?

No. You can do that.

As to why it's failing for you, you haven't provided any information about your Zen Cart, or your URL rewriting mod, or the rest of your .htaccess file, or even what the error is.

Might it be a "can't complete" type error because you're trying to redirect the page to itself?

29 Jul 2010, 9:54 AM
#3
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

Sorry about that
I’m just finishing a new upgrade to our site but I need to get shot of a loads of old html. The site is now up to date on 1.3.9e and I added the code after a blank line to the existing .htaccess file.
The error without even going to a redirected page read....
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

You lost me with the URL rewriting mod all I added was the line of redirect code

29 Jul 2010, 9:58 AM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 301 redirect from html to php?

OK. Let's take a step back. Why are you trying to redirect this URL? The old URL does not indicate the presence of html pages, just that you can a piece of code on your site that makes your php generated pages look as they're html.

You can stop this by turning off whatever SEO URL package you have installed.

29 Jul 2010, 10:01 AM
#5
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

The original site was a large mix of html from before started using zencart and the more recent zen php. The upgrade is about ready to implement and I want to reduce the html work without throwing away the SEO

29 Jul 2010, 10:05 AM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 301 redirect from html to php?

OK. But what you're trying to replace there isn't html, it's a php link that's been re-written to look like HTML. So you're sending your browser round in circles, as you try to force it to a php page and your SEO URLs package rewrites it back to look like html, in what would be a never ending process if there weren't a server error designed to stop infinite loops.

29 Jul 2010, 10:11 AM
#7
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

Is there a better way to do it without loss of seo or am I doomed to doubling up work with html

29 Jul 2010, 10:15 AM
#8
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 301 redirect from html to php?

That rewriting of the links to look like html pages is most like all that your SEO module is doing for you. So your question is contradictory.

Could you clarify what the ultimate "it" you're trying achieve is? If it's just about removing html pages that pre-date your Zen Cart, then you're attacking the wrong links.

Using SEO URLs does tend to create double links. One being what the SEO package generates and wants search engines to see and index, and the other the underlying dynamic link.

29 Jul 2010, 10:23 AM
#9
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

I think I have confused you somewhere. The SEO I meant was the page ranking and inbound links to the html pages not an SEO mod. All I need to do is permanently redirect all of that to the php page holding the relevant content for that HTML page

29 Jul 2010, 10:31 AM
#10
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: 301 redirect from html to php?

OK. You can do this and to do so you would need to set up redirects for every page on your site and turn your SEO module off so that it stops rewriting the URLs back to their current format.

But that's an awful lot of work for this result:

  • some loss of SEO benefit as your URLs would no longer contain keywords
  • a degradation in the performance of your site as the very large .htaccess file would need to be processed and the browser redirected for every page load.
29 Jul 2010, 10:39 AM
#11
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

DO you think it would be better to just bin the overlapping html and use a 404 redirect to the home page

31 Jul 2010, 10:16 PM
#12
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

H, just an update. Found the fault I was having with the 301 code. White space. I’ve added a .htaccess file to each of the directories I needed to move and they were all working properly until I got to a directory with a space in the title, then I get a 500 server error. I tried   but that didn’t help. Think this is to technical for me.
Thanks for all your help

31 Jul 2010, 10:43 PM
#13
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: 301 redirect from html to php?

Sorted it, the url with the white space had to be in inverted comas and now it's working great.
thanks for all your help