Zen Cart Logo
Forums / General Questions / redirect pages using .htaccess

redirect pages using .htaccess

Views: 799

Results 1 to 2 of 2
20 Mar 2014, 2:29 PM
#1
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

redirect pages using .htaccess

I moved my store from root to a folder /store/ and need to redirect some pages using .htaccess (they have backlinks to them) - example;
/index.php?main_page=index&cPath=11 redirect to /store/index.php?main_page=index&cPath=11

I have tried a few rewrite rules and formats to no avail.

What is the correct rewrite rule and format for .htaccess? (I assume the .htaccess file with redirects should reside in the root, not in the /store/ directory)

cheers,
Mike

20 Mar 2014, 3:56 PM
#2
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: redirect pages using .htaccess

Please list all the "methods" you have tried (better chance of getting a response).

Have you tried either of the following (use only one or the other):

RewriteEngine On

# Uncomment the next two lines to FORCE a redirect (issue a 301 to new location)
#RewriteRule ^store/index.php$ /index.php [R=301,QSA,L]
#RewriteRule ^store/?$ / [R=301,QSA,L]

# Uncomment the next two lines to silently rewrite (canonical will contain new location)
#RewriteRule ^store/index.php$ index.php [QSA,L]
#RewriteRule ^store/?$ index.php [QSA,L]

Notes: Depending upon your server you may need to add a leading "/" (ex: "^/store/index.php$"). To uncomment a line remove the leftmost # from the line. The above assume the IDs in the database for products, categories, ez-pages, etc have not changed. Above examples should go in a .htaccess file in the same folder as the new Zen Cart's "index.php" file.