Forums / General Questions / htaccess redirect for specific pages

htaccess redirect for specific pages

Locked

Views: 1,801

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
20 Jan 2009, 7:30 AM
#1
glw35 avatar

glw35

New Zenner

Join Date:
Jan 2009
Posts:
5
Plugin Contributions:
0

htaccess redirect for specific pages

I've found several discussions on htaccess redirects, but none that answer my questions. Hopefully, someone knows how to do this.

My client's site already had an html site and a contact page prior to zencart being installed and he wants to keep these. There are a couple of things I want to do to ensure visitors reach the correct pages.

  1. index.php - I would like that and only that to redirect to another page. Obviously, everything is built off of this file, so it's tricky. I want /catalog/index.php to redirect but I of course do not want index.php?main_page=... to redirect. I made it work in the robots.txt file by adding a $. It just doesn't work in htaccess.

  2. index.php?main_page=contact_us - I would like that to redirect, but I just can't make it work. I have read that the ? and = are tricky, I just can't find the answers to it.

Any thoughts on each of these?

FYI - For those that have other suggestions or workarounds, I've already hidden these pretty well - it's mostly for that one guy that likes to play with URLs and manually type in /catalog/index.php - I already have an index.html with a redirect to the non zen cart home page for the catalog folder, but I want to do the same for one who types in the index.php, too.

Same with the Contact_Us - I think I've changed all of the files to use the non Zen contact page, but just in case I missed one, I would like it to redirect so we don't have to worry about it.

20 Jan 2009, 12:09 PM
#2
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: htaccess redirect for specific pages

If your client's site is hosted on a server that uses cPanel then you may want to consider just using the redirect facility within cPanel for the relevant pages/URL's

Frank

https://www.zencart.frnt.org

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

20 Jan 2009, 4:26 PM
#3
glw35 avatar

glw35

New Zenner

Join Date:
Jan 2009
Posts:
5
Plugin Contributions:
0

Re: htaccess redirect for specific pages

no cPanel on this host - I have to do it the old fashioned way.

20 Jan 2009, 5:43 PM
#4
kraiton avatar

kraiton

New Zenner

Join Date:
Jan 2009
Posts:
21
Plugin Contributions:
0

Re: htaccess redirect for specific pages

Here is a code that you can put into any page and just set the web address you want to redirect to. I am not sure if this will hep, but if so, please let me know that it did so I know that this is resolved:

<META HTTP-EQUIV=refresh content="0; url=http://www.PUT THE WEBSITE ADDRESS HERE.com">

Just place this code in the body of any page you want to redirect with the correct web address. If you do not have a page setup for the address, just make a simple HTML page and put the code in the body of the page and it will direct your pages to any page you want it to.

The Best Little Gift Shop Our Products Have Over 60 Years Of Customer Satisfaction.

23 Jan 2009, 10:04 PM
#5
glw35 avatar

glw35

New Zenner

Join Date:
Jan 2009
Posts:
5
Plugin Contributions:
0

Re: htaccess redirect for specific pages

It mostly works for the contact page, but there is a 1 or 2 second delay while it's loading the other page. It's a little clunky, but it will work, though.

It doesn't work for the index.php page, since doing this effectively redirects every page built off of it, which is almost all of them.

23 Jan 2009, 11:43 PM
#6
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: htaccess redirect for specific pages

  1. index.php - I would like that and only that to redirect to another page.
    This would be the first thing in your index.php file.
 // Must be index.php to redirect every thing else passes through
if ( basename($_SERVER['REQUEST_URI']) == 'index.php')
{
   header('Location: http://www.where_to_go.com');
}

Skip

• 446F63746F722057686F •